控制臺(tái)可能會(huì)輸出以下警告信息
- 警告的原因: [UIImage imageNamed:nil]
CUICatalog: Invalid asset name supplied: (null)
CUICatalog: Invalid asset name supplied: (null)
- 警告的原因: [UIImage imageNamed:@""]
CUICatalog: Invalid asset name supplied:
CUICatalog: Invalid asset name supplied:
準(zhǔn)確判斷一個(gè)字符串是否有內(nèi)容
if (string.length) {
}
/*
錯(cuò)誤寫法:
if (string) {
}
*/
替換UITabBarController內(nèi)部的tabBar
// 這里的self是UITabBarController
[self setValue:[[XMGTabBar alloc] init] forKeyPath:@"tabBar"];
center和size的設(shè)置順序
- 建議的設(shè)置順序
- 先設(shè)置size
- 再設(shè)置center
給系統(tǒng)自帶的類增加分類
@interface UIView (CLExtension)
@property (nonatomic, assign) CGFloat cl_width;
@property (nonatomic, assign) CGFloat cl_height;
@property (nonatomic, assign) CGFloat cl_x;
@property (nonatomic, assign) CGFloat cl_y;
@property (nonatomic, assign) CGFloat cl_centerX;
@property (nonatomic, assign) CGFloat cl_centerY;
@property (nonatomic, assign) CGFloat cl_right;
@property (nonatomic, assign) CGFloat cl_bottom;
@end
按鈕常見(jiàn)的訪問(wèn)方法
[button imageForState:UIControlStateNormal].size;
button.currentImage.size;
[button backgroundImageForState:UIControlStateNormal];
button.currentBackgroundImage;
[button titleForState:UIControlStateNormal];
button.currentTitle;
[button titleColorForState:UIControlStateNormal];
button.currentTitleColor;
設(shè)置按鈕的內(nèi)邊距
@property(nonatomic) UIEdgeInsets contentEdgeInsets UI_APPEARANCE_SELECTOR;
@property(nonatomic) UIEdgeInsets titleEdgeInsets;
@property(nonatomic) UIEdgeInsets imageEdgeInsets;
解決導(dǎo)航控制器pop手勢(shì)失效
self.interactivePopGestureRecognizer.delegate = self;
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
// 手勢(shì)何時(shí)有效 : 當(dāng)導(dǎo)航控制器的子控制器個(gè)數(shù) > 1就有效
return self.childViewControllers.count > 1;
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者