Button
- (IBAction)top:(UIButton *)sender {
CGRect btnFrame = self.headBtn.frame;
btnFrame.origin.y -= 10;
self.headBtn.frame = btnFrame;
}
//在Xcode6以后编译成功
self.headBtn.frame.origin.y -= 10;
// 创建一个自定义的按钮
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
// 默认状态的背景
[btn setBackgroundImage:[UIImage imageNamed:@"btn_01"] forState:UIControlStateNormal];
// 默认状态的文字
[btn setTitle:@“点击我" forState:UIControlStateNormal];
// 默认状态的文字颜色
[btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
[UIView beginAnimations:nil context:nil];
/** 需要执行动画的代码 **/
[UIView commitAnimations];
[UIView animateWithDuration:0.5 animations:^{
/** 需要执行动画的代码 **/
}];
(angle是弧度制,并不是角度制)
view.transform = CGAffineTransformIdentity;
为自己写的button 注册一个 触发方法 为back [bt addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
开启用户交互功能 比如imageview.userInteractionEnabled=YES;
会影响按钮内部的所有内容(里面的imageView和titleLabel)top left bottom right 四个方向的距离
Button shareBtn
shareBtn.contentEdgeInsets =UIEdgeInsetsMake(a,b,c,d);
只影响内部的title
shareBtn.titleEdgeInsets = UIEdgeInsetsmake()