selector可以为控件指定响应的方法,只能调用本类中的方法(貌似也可以通过delegate调用其他类的方法);
例如,我们需要给button按钮指定一个点击的响应方法:
[bt addTarget:selfaction:@selector(print)
forControlEvents:UIControlEventTouchUpInside];
通过添加action的selector来给点击button添加方法print,在print函数中编写我们需要的实现代码即可.
PS:程序运行时,自动横屏,只需在plist中添加一项intital interface orientaton,在右边的值中填写需要的方向即可