UIButton : UIControl <NSCoding>
1.创建一个UIButton对象
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(30, 140, 280, 30);
2.- (void)setTitle:(NSString *)title forState:(UIControlState)state;
设置按钮显示文字
eg:[button setTitle:@"点击" forState:UIControlStateNormal];
3.showsTouchWhenHighlighted
点击的时候设置button的高亮
eg:button.showsTouchWhenHighlighted = YES;
4.- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;
给按钮绑定一个方法,点击的时候 让某个特定的对象调用这个方法
参数1:执行方法的对象
参数2:要执行的方法(参数1的对象去执行)
参数3:按钮让绑定的对象调用方法,需要触发的事件
[button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
UIAlertView : UIView
1.创建一个UIAlertView对象
- (instancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id /*<UIAlertViewDelegate>*/)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles
eg:UIAlertView *alertview = [[UIAlertView alloc]initWithTitle:@"提示" message:@"message" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@“确定1",@“确定2", nil];
2.- (void)show;
显示UIAlertView
eg:[alertview show];
3.- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
点击了alertView上的哪个按钮