导航栏先关设计
来源:互联网 发布:软件测试怎么自学 编辑:程序博客网 时间:2024/06/06 03:55
//设计导航条背景图片
if ([[UIDevicecurrentDevice].systemVersionfloatValue] >= 5.0 ) {
[self.navigationController.navigationBarsetBackgroundImage:[UIImageimageNamed:@"Topbar_Img.png"]forBarMetrics:UIBarMetricsDefault];
}else{
self.navigationController.navigationBar.layer.contents = (id)[UIImageimageNamed: @"Topbar_Img.png"].CGImage;
}
//在导航上添加按钮
UIView *tempView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, 80, 44)];
UIButton *right =[[UIButtonbuttonWithType:UIButtonTypeCustom]retain];
[right setImage:[UIImageimageNamed:@"filter.png" ]forState:UIControlStateNormal];
right.frame =CGRectMake(50, 6,31, 31);
right.exclusiveTouch =YES;
[right addTarget:selfaction:@selector(riddling)forControlEvents:UIControlEventTouchUpInside];
UIButton *photo =[[UIButtonbuttonWithType:UIButtonTypeCustom]retain];
[photo setImage:[UIImageimageNamed:@"puzzle.png" ]forState:UIControlStateNormal];
photo.frame =CGRectMake(10, 6+2,31, 31);
photo.exclusiveTouch =YES;
[photo addTarget:selfaction:@selector(goPuzzle)forControlEvents:UIControlEventTouchUpInside];
[tempView addSubview:right];
[tempView addSubview:photo];
[right release];
[photo release];
UIBarButtonItem *ubbi =[[UIBarButtonItemalloc] initWithCustomView:tempView];
self.navigationItem.rightBarButtonItem =ubbi;
[ubbi release];
//设计导航图片的,重写该方法,实现导航图片的方法2
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
//设计按钮的颜色
[selfsetTintColor:[UIColorcolorWithRed:0.83green:0.89blue:0.62alpha:0.7]];
//设计导航栏的图片的
UIImage *image = [UIImageimageNamed: @"Topbar_Img.png"];
//将图片放入导航栏
[image drawInRect:CGRectMake(0,0, self.frame.size.width,self.frame.size.height)];
}
@end
//在导航视图中添加按钮
UIBarButtonItem *leftBtn = [[UIBarButtonItemalloc]
initWithTitle:@"next"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(pushController)]; //监听要做出的响应
self.navigationItem.leftBarButtonItem = leftBtn;
//设计导航图片的方法1
//self.navigationController.navigationBar.layer.contents = (id)[UIImage imageNamed: @"Topbar_Img.png"].CGImage;
//设计导航颜色的
//self.navigationController.navigationBar.tintColor = [UIColor yellowColor];
//[self.navigationController.navigationBar setTintColor:[UIColor colorWithRed:0.83 green:0.89 blue:0.62 alpha:0.7]];
- 导航栏先关设计
- CSS设计导航栏
- 关注导航栏设计
- jquery-导航设计
- CSS导航设计
- 导航条设计
- 设计类酷站导航
- 网站导航设计二三事
- 不错的导航设计
- 网站导航设计策略
- Java设计模式-导航
- 设计师设计库导航
- 智能电视导航设计
- 横向导航设计
- 导航页面设计
- 主页导航设计
- Photoshop-设计导航
- 导航设计:8种移动APP导航设计模式
- 使用GDI绘制直线
- Oracle创建Job时遇到ORA-04063 SYS.DBMS_INTERNAL_LOGSTDBY的解决办法
- MyEclipse 8.6 囧囧囧
- yum安装
- 取得电话当前的状态
- 导航栏先关设计
- [iphone][debug]putpkt: write failed: Broken pipe
- 蓝桥杯2012预赛java高职题分析
- LayoutInflater和inflate()方法的用法
- HDFS1.0源代码解析—DataNode状态切换
- poj 2503 Babelfish
- SQLite支持的数据类型(日期函数)
- 栈:自下而上输出【导入另一个栈再输出】
- MFC的 在对话框显示图片的方法