一些常見的小技巧用法

1、 隱藏tableViewCell的分割線:
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

2、實現右側的小灰色箭頭 只要將cell的accessoryType屬性設置為 cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;

//關閉tableView選中的動畫
[tableView deselectRowAtIndexPath:indexPath animated:NO];

//關閉tableView頂部的cell冒出來的白色空隙
self.automaticallyAdjustsScrollViewInsets = NO

 開啟手勢返回
 self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;

3、毛玻璃效果(ios8.0以后的版本)

UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
    visualEffectView.frame = CGRectMake(0, 0, 320, 180);
    visualEffectView.alpha = 1.0;

4、整個項目iOS手勢(滑動)返回
1>、iOS手勢(滑動)返回首先在根控制器下 遵守UIGestureRecognizerDelegate協議
2>在跟控制器下寫入以下代碼,輕松開啟手勢返回

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    //代理置空,否則會閃退
    if ([self.navigationController       respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.delegate = nil;
        
    }
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    //開啟iOS7的滑動返回效果
    if ([self.navigationController   respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        //只有在二級頁面生效
        if ([self.navigationController.viewControllers count] == 2) {
            self.navigationController.interactivePopGestureRecognizer.delegate = self;
        }
    }
}

5、自定義導航欄返回按鈕

 UIBarButtonItem *leftBarBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"返回-1"] style:UIBarButtonItemStylePlain target:self action:@selector(goBack)];
    self.navigationItem.leftBarButtonItem = leftBarBtn;

6、導航欄全透明,無黑邊

 //    導航欄變為透明
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:0];
    //    讓黑線消失的方法
    self.navigationController.navigationBar.shadowImage=[UIImage new];
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • 做到日更其實并不容易,可是如果你要是下定決心,也一定可以做到。比如現在的我,只有條件允許,手機不壞,不被上交,有自...
    一訪文閱讀 367評論 2 9
  • 蓮開仲夏結初見, 淡淡飛花淺語香。 有幸相識天眷戀, 為君一飲孟婆湯。 / 蘭亭秀影素顏妝, 笑與輕風夏夜涼。 夢...
    閩江學院閱讀 309評論 0 0
  • 突破式思維,怎么想,怎么想的更新穎,更有價值,得出超出尋常的新見解 加法策略:兩個或者多個產品元素結合在一起,形成...
    小柒姐姐閱讀 159評論 0 0
  • 從媒介革命的視野出發,網絡文學并不是通俗文學的“網絡版”,而是一種新媒介文學形態。它顛覆的不是印刷文明下的雅俗秩序...
    王乓乓閱讀 597評論 0 5