拖一个image viewwshang 上去,设置大小
ios6导航控制器的根控制器y坐标开始不包括导航条,
在ILTabBarViewController.m中多了个属性 为什么不一样,穿透导航条,上下滚动时有穿透效果
ILTabBarViewController.m中:
self.edgesForExtendedLayout = UIRectEdgeNone ;//不伸展
或者
ios6被拉伸了,不想被拉伸
command+option(中间那个键)+回车 界面和代码都显示
登陆按钮,背景图片拉伸:
只有uiimageview可以拉伸,按钮需用代码拉伸:
创建ILLoginViewController: UIViewController
uiimageview:
Stretching(拉伸):
x: 左边需要保护的比例(右边由width影响)
y: 上边需要保护的比例(下边由height影响)
width:除去左边需要保护的部分,拉伸宽度部分的比例(0代表1像素)
height:除去上边需要保护的部分,拉伸高度部分的比例(0代表1像素)
按钮拉伸:
创建登陆控制器ILLoginViewController : UIViewController,把整个登陆界面的class指定为它
拖住登陆按钮,创建属性 loginBtn
ILLoginViewController.m中
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
// 设置登录按钮的拉伸好的图片
[_loginBtn setBackgroundImage:[UIImage imageWithResizableImageName:@"RedButton"] forState:UIControlStateNormal];
[_loginBtn setBackgroundImage:[UIImage imageWithResizableImageName:@"RedButtonPressed"] forState:UIControlStateHighlighted];
}
创建uiimage分类,放Other Category里
+ (instancetype)imageWithResizableImageName:(NSString *)imageName //instancetype返回类的对象
{
UIImage *image = [UIImage imageNamed:imageName];
image = [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5]; //左边多少不要拉伸,上面多少不要拉伸
return image;
}