ios開發技巧(一)
阿新 • • 發佈:2017-06-25
nss sets pos 哪裏 tro size wid navi tran
iOS的一些小技巧
TableView不顯示沒內容的Cell怎麽辦?
類似這樣的,我不想讓以下那些空的顯示.
非常easy.
self.tableView.tableFooterView = [[UIView alloc] init];
試過的都說好.
加完這句之後就變成了這樣.
自己定義了leftBarbuttonItem左滑返回手勢失效了怎麽辦?
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:img style:UIBarButtonItemStylePlain target:self action:@selector(onBack:)]; self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
ScrollView莫名其妙不能在viewController劃到頂怎麽辦?
self.automaticallyAdjustsScrollViewInsets = NO;
鍵盤事件寫的好煩躁,都想摔鍵盤了,怎麽辦?
- 買個結實的鍵盤.
- 使用IQKeyboardManager(github上可搜索),用完之後腰也不疼了,腿也不酸了.
為什麽我的app老是不流暢,究竟哪裏出了問題?
如圖
這個神器叫做:KMCGeigerCounter
快去github搬運吧.
怎麽在不新建一個Cell的情況下調整separaLine的位置?
_myTableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);
怎麽點擊self.view就讓鍵盤收起,須要加入一個tapGestures麽?
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.view endEditing:YES];
}
怎麽給每一個ViewController設定默認的背景圖片?
使用基類啊,少年.
想在代碼裏改在xib裏加入的layoutAttributes,可是怎麽用代碼找啊?
像拉button一樣的拉你的約束.nslayoutattribute也是能夠拉線的.
怎麽像safari一樣滑動的時候隱藏navigationbar?
navigationController.hidesBarsOnSwipe = Yes
導航條返回鍵帶的title太討厭了,怎麽讓它消失!
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
CoreData用起來好煩,語法又臭又長,怎麽辦?
MagicalRecord
CollectionView 怎麽實現tableview那種懸停的header?
CSStickyHeaderFlowLayout
ios開發技巧(一)