• 导航栏上的item的位置设置


     /**
         leftItem
         */
        UIButton *leftbtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
        [leftbtn setImage:[UIImage imageNamed:@"public_back_n"] forState:UIControlStateNormal];
        [leftbtn addTarget:self action:@selector(clickBackItem) forControlEvents:UIControlEventTouchUpInside];
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftbtn];
        UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
        negativeSpacer.width = 40;// 右移  负左移
        self.navigationItem.leftBarButtonItems = @[negativeSpacer,self.navigationItem.leftBarButtonItem];
        
        /**
         rightItem
         */
        UIButton *rightbtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
        [rightbtn setImage:[UIImage imageNamed:@"public_appraise_icon"] forState:UIControlStateNormal];
        [rightbtn addTarget:self action:@selector(clickBackItem1) forControlEvents:UIControlEventTouchUpInside];
        
        
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightbtn];
        UIBarButtonItem *rightnegativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
        rightnegativeSpacer.width = 40; //左移  负右移
        self.navigationItem.rightBarButtonItems = @[rightnegativeSpacer,self.navigationItem.rightBarButtonItem];
        
  • 相关阅读:
    C# 获取文件的修改时间、访问时间、创建时间
    Nhibernate Or多条件查询
    C# 将GridView当前页数据导成Execl
    C# 清空文件夹
    TreeView默认收缩
    JS控制控件的隐藏显示
    div置顶,不随滚动条滚动而滚动
    js 父窗体与子窗体的调用
    树形菜单的绑定以及链接
    2010.10.16 OA项目组一周报告 CQ
  • 原文地址:https://www.cnblogs.com/liuwenqiang/p/7441729.html
Copyright © 2020-2023  润新知