UIDevice.currentDevice().performSelector(
"setOrientation:",
withObject:UIInterfaceOrientation.LandscapeRight
)
有如上代码 后面 withObject 的参数是一个 AnyObject 类型的,这样直接传的话会报错,试过几种方法都不行,求大神帮忙。T T
伊谢尔伦2017-04-17 17:47:44
id corresponds to AnyObject?, you define a var with ? and try it:
import Foundation
func displayObjectName(yourobject : AnyObject?)
{
NSLog("%@",yourobject as! String);
}
var s:String?="Hello,World";
displayObjectName(s);