ios开发常用的技巧

来源:互联网 发布:会声会影x7软件多大 编辑:程序博客网 时间:2024/05/16 13:41
转自 http://blog.csdn.net/kerry_deng/article/details/46759307点击打开链接
这些其实不是什么技巧,只是iOS里面经常用到的一些属性或方法,只是我们记得不牢固。
  1. 让tableView 不显示没内容的cell   myTableView.tableFooterView = [[UIView alloc] init];
  2. 去掉cell的点击状态 [myCell setSelectionStyle:UITableViewCellSelectionStyleNone]
  3. 去掉cell的分割线  myTableView.separatorStyle = No
  4. 实现右侧的小灰色箭头  myCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator 其他格式:像对勾、删除什么类似,更改一下属性值即可
  5. 点击self.view就收键盘,不需要再麻烦了   -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        [
    self.view endEditing:YES];
    }
  6. 怎么把navigationbar 弄成透明的而不是模糊的效果    
        [
    self.navigationController.navigationBar setBackgroundImage:[UIImage new]forBarMetrics:UIBarMetricsDefault];
       
     self.navigationController.navigationBar.shadowImage = [UIImage new];
       
     self.navigationController.navigationBar.translucent = YES;
  7. 给button的title加下滑线(iphone6以上自带)
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"查看所有中奖记录"];
    NSRange strRange = {0,[str length]};  
    [str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];  
    [_awardDisplayBtn setAttributedTitle:str forState:UIControlStateNormal];
  8. push到下一个界面是,有个过渡的阴影,怎么解决?跳转之前设一下下个页面的背景颜色
  9. 修改系统自带返回按钮的颜色
    self.navigationController.navigationBar.barStyle = UIStatusBarStyleDefault;[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
  10. 去掉返回箭头的title
      UIBarButtonItem *backItem=[[UIBarButtonItem alloc]init];
      backItem.title=@"";
      self.navigationItem.backBarButtonItem = backItem;
      这里的self跳转前的控制器

          或者自己添加左button,先和平常创建button一样创一个custombutton.
           self.navigationcontroller.navigationitem.leftbuttonitem = custombutton 
          这里的self是跳转后的控制器。
0 0
原创粉丝点击