- 导航栏透明:
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
- 隐藏无内容cell
myTableView.tableFooterView = [[UIView alloc] init];
- 去掉cell的点击状态
[myCell setSelectionStyle:UITableViewCellSelectionStyleNone];
- cell的分割线
myTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;(样式) myTableView.separatorColor = [UIColor grayColor];(颜色)
myTableView.separatorInset = UIEdgeInsetsMake(0,5, 0, 0);(距离上下左右)
- cell右侧小箭头
myCell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
- 点击self.view收键盘
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.view endEditing:YES];
}
- 给button的title加下滑线
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"查看所有中奖记录"];
NSRange strRange = {0,[str length]};
[str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];
[_awardDisplayBtn setAttributedTitle:str forState:UIControlStateNormal];
- label不同颜色
NSMutableAttributedString *attributeMyPriceStr = [[NSMutableAttributedStringalloc] initWithString:[NSStringstringWithFormat:@"价格:%@元/小时",[dictonary objectForKey:@"myPrice"]]];
NSUInteger myPriceLength = [NSStringstringWithFormat:@"%@",[dictonary objectForKey:@"myPrice"]].length;
[attributeMyPriceStr addAttribute:NSForegroundColorAttributeNamevalue:[UIColorredColor] range:NSMakeRange(3, myPriceLength+4)];
_parkPriceLabel.attributedText = attributeMyPriceStr;
push到下一个界面是,有个过渡的阴影,怎么解决?跳转之前设一下下个页面的背景颜色
去掉返回箭头的title
UIBarButtonItem *backItem=[[UIBarButtonItem alloc]init];
backItem.title=@"";
self.navigationItem.backBarButtonItem = backItem;
或者:
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
ScrollView 的contentsize.height=0即可禁止上下滚动
同理contentsize.width =0即可禁止左右滚动。但是7.0系统之后为什么有时候不起效果呢?
因为 如果一个控制器中出现两个以上的UIScrollView(包括其子类),automaticallyAdjustsScrollViewInsets这个属性需要设置为NO.即不会预留空白。(7.0之后默认是YES)在不缩放图片,不去掉title的前提下,替换backBarButton图片的方法:(原理很简单,第一行加载图片,第二行以加载图片的宽度结合resizableImageWithCapInsets生成一个缩放时不会拉伸的新图片作为BackButtonBackgroundImage,再在第三行设置title的位置偏移到一个不可见的位置,达到隐藏的目的。另外,如果需要全部统一替换,也可以在app的didFinishLaunching里通[UIBarButtonItem appearance]全部统一替换!)
UIImage* image = [UIImage imageNamed:@"back_button.png"];
[item setBackButtonBackgroundImage:[image resizableImageWithCapInsets:UIEdgeInsetsMake(0, image.size.width, 0, 0)] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[item setBackButtonTitlePositionAdjustment:UIOffsetMake(-400.f, 0) forBarMetrics:UIBarMetricsDefault];
self.navigationItem.backBarButtonItem = item;