码迷,mamicode.com
首页 > 其他好文 > 详细

UI学习之常用方法(续)

时间:2015-11-19 20:38:07      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:

UINavigationController

    UIButton *myButton = [UIButton buttonWithType:UIButtonTypeSystem];
    //[UIButton buttonWithType:UIButtonTypeCustom];//显示真实图标颜色
    myButton.frame = CGRectMake(0, 0, 30, 30);
//    myButton.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"home"]];
    [myButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];//建议使用方式
//    [myButton setTitle:@"返回" forState: UIControlStateNormal] ;
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc]initWithCustomView:myButton];
    UIButton *myButton1 = [UIButton buttonWithType:UIButtonTypeSystem];
    myButton1.frame = CGRectMake(0, 0, 30, 30);
    //    myButton.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"login"]];//无点击效果,保留色彩
    [myButton1 setImage:[UIImage imageNamed:@"home"] forState:UIControlStateNormal];//建议使用方式
    //    [myButton setTitle:@"返回" forState: UIControlStateNormal] ;
    UIBarButtonItem *backButton1 = [[UIBarButtonItem alloc]initWithCustomView:myButton1];
    self.navigationItem.leftBarButtonItem = backButton;
    self.navigationItem.rightBarButtonItem = backButton1;

 

UI学习之常用方法(续)

标签:

原文地址:http://www.cnblogs.com/liuguan/p/4978828.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!