您的位置:首页 > 移动开发 > IOS开发

ios开发常用的技巧

2016-04-12 16:50 525 查看
转自 http://blog.csdn.net/kerry_deng/article/details/46759307点击打开链接
这些其实不是什么技巧,只是iOS里面经常用到的一些属性或方法,只是我们记得不牢固。
让tableView 不显示没内容的cell   myTableView.tableFooterView = [[UIView alloc] init];
去掉cell的点击状态 [myCell setSelectionStyle:UITableViewCellSelectionStyleNone]
去掉cell的分割线  myTableView.separatorStyle = No
实现右侧的小灰色箭头  myCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator 其他格式:像对勾、删除什么类似,更改一下属性值即可
点击self.view就收键盘,不需要再麻烦了   -(void)touchesBegan:(NSSet *)touches
withEvent:(UIEvent *)event

{

    [self.view endEditing:YES];

}
怎么把navigationbar 弄成透明的而不是模糊的效果    

    [self.navigationController.navigationBar setBackgroundImage:[UIImage new]forBarMetrics:UIBarMetricsDefault];

    self.navigationController.navigationBar.shadowImage =
[UIImage new];

    self.navigationController.navigationBar.translucent = YES;
给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];
push到下一个界面是,有个过渡的阴影,怎么解决?跳转之前设一下下个页面的背景颜色
修改系统自带返回按钮的颜色
self.navigationController.navigationBar.barStyle = UIStatusBarStyleDefault;[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
去掉返回箭头的title
      UIBarButtonItem *backItem=[[UIBarButtonItem alloc]init];
      backItem.title=@"";
      self.navigationItem.backBarButtonItem = backItem;
      这里的self跳转前的控制器

          或者自己添加左button,先和平常创建button一样创一个custombutton.
           self.navigationcontroller.navigationitem.leftbuttonitem = custombutton 
          这里的self是跳转后的控制器。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: