【iOS】那些年,遇到的小坑

丶Pz發表於2016-02-19

'NSInvalidArgumentException', reason: '-[__NSPlaceholderDictionary initWithObjectsAndKeys:]: second object of each pair must be non-nil.  Or, did you forget to nil-terminate your parameter list?'

解決方法:[[NSDictionary allocinitWithObjectsAndKeys  每個key和value都不能為nil,最後要加一個nil,另外數值型別的要加 @符號轉換成物件

TabBarController 跳到子Controller時候,隱藏tabbar屬性

解決方法:

ViewController *controller = [ViewController new];
controller.hidesBottomBarWhenPushed = YES;//隱藏bottomBar
[self.navigationController pushViewController:controller animated:YES];

 

UITableView add到某個新增了手勢的View上,手勢阻擋點選Cell事件的問題。解決方案:

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
    // 若為UITableViewCellContentView(即點選了tableViewCell),則不截獲Touch事件
    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
        return NO;
    }
    return  YES;
}

相關文章