美文网首页
10个开发小技巧

10个开发小技巧

作者: 小王在努力 | 来源:发表于2018-06-29 16:03 被阅读18次

1.隐藏多余的tableView的cell分割线

self.tableView.tableFooterView= [[UIView alloc]init];

2.取消系统自带的返回字样

[[UIBarButtonItem appearance]setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];

3.滑动时隐藏navigation

self.navigationController.hidesBarsOnSwipe=YES;

4.页面跳转是隐藏tabBar

TwoViewController *twoVC = [[TwoViewController alloc] init];

twoVC.hidesBottomBarWhenPushed =YES;

5.ScrollView不能滑到顶

self.automaticallyAdjustsScrollViewInsets=NO;

6.按钮点击发光效果

button.showsTouchWhenHighlighted =YES;

7.长按手势只执行一次

if(sender.state == UIGestureRecognizerState)

8.隐藏状态栏

- (BOOL)prefersStatusBarHidden

{

returnYES;

}

9.在使用view的缩放的时候,layer.border.width随着view的放大,会出现锯齿化的问题。

self.layer.allowsEdgeAntialiasing = YES;

10、在自定义返回按钮的时候,侧滑手势返回往往默认失效了,怎么让侧滑有效呢

    UIButton  *btn =[UIButton buttonWithType:UIButtonTypeCustom];

    [btn setTitle:@"返回" forState:UIControlStateNormal];

    [btn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];

    btn.frame=CGRectMake(0, 0, 60, 40);

    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    UIBarButtonItem  *item =[[UIBarButtonItem alloc]initWithCustomView:btn];

    self.navigationItem.leftBarButtonItem=item;

添加下面这一句代码即可

 self.navigationController.interactivePopGestureRecognizer.delegate=(id)self;

相关文章

  • 使用Storyboards开发的10个小技巧

    使用Storyboards开发的10个小技巧 使用Storyboards开发的10个小技巧

  • iOS开发小技巧:根据文本,字体,计算UILabel高度及宽度

    iOS开发小技巧:根据文本,字体,计算UILabel高度及宽度 iOS开发小技巧:根据文本,字体,计算UILabe...

  • 2--NSTimer

    大纲: 创建计时器 暂停 恢复 销毁 开发小技巧 一、创建计时器 二、暂停 三、恢复 四、销毁 五、开发小技巧

  • 开发小技巧

    表格中刷新指定分区,UITableViewRowAnimationFade淡入淡出动画,[str integerV...

  • 开发小技巧

    *- 捡起初心, 慢慢走,希望自己好好努力,志于不用工作的人 * 1、禁止第三方键盘 在要填密码的地方, 为了安全...

  • 开发小技巧

    1、页面上的图片可以有两中形式: img和给 设置背景图background-img,一般需要占位的图片使用img...

  • 开发小技巧

    收起键盘的三种方法 1.重载UIViewController的touchesBegin方法,在里面执行[self....

  • iOS开发小技巧之--WeakSelf宏的进化

    iOS开发小技巧之--WeakSelf宏的进化

  • 小程序开发小技巧

    如何去掉button的边框? wxml wxss 参数传值的方法 data-id 我们可以给HTML元素添加dat...

  • IOS开发小技巧

    1、让Xcode显示编译时间,关闭Xcode,然后在终端输入命令 2、如何浏览苹果开源网站 从苹果源码首页下看到O...

网友评论

      本文标题:10个开发小技巧

      本文链接:https://www.haomeiwen.com/subject/lzavhttx.html