首页 > 代码库 > ios 控件 UIButton
ios 控件 UIButton
- (void)setTitle:(NSString *)title forState:(UIControlState)state;//设置标题
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;//设置标题颜色
- (void)setTitleShadowColor:(UIColor *)color forState:(UIControlState)state;//设置标题阴影
- (void)setImage:(UIImage *)image forState:(UIControlState)state;//设置图片
- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;//设置图片背景
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(100, 150, 60, 40);//设置按钮位置大小
[button setTitle:@"Normal" forState:UIControlStateNormal];//设置常规下按钮的标题
[button setTitle:@"Normal" forState:UIControlStateNormal];//设置常规下按钮的标题
[button setTitle:@"Highlight" forState:UIControlStateHighlighted];//设置高亮状态下的标题
[button addTarget:self action:@selector(didButtonClicked)forControlEvents:UIControlEventTouchUpInside];//设置按钮的点击事件
[self.view addSubview:button];//显示在页面上
ios 控件 UIButton
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。