p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #d28f5a}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #4cbf57}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #ffffff; min-height: 21.0px}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #ffffff}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #c2349b}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px 'Heiti SC Light'; color: #ffffff}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px 'Heiti SC Light'; color: #4cbf57}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px 'Heiti SC Light'; color: #d28f5a}p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #e44448}span.s1 {font-variant-ligatures: no-common-ligatures}span.s2 {font: 18.0px 'Heiti SC Light'; font-variant-ligatures: no-common-ligatures}span.s3 {font-variant-ligatures: no-common-ligatures; color: #c2349b}span.s4 {font-variant-ligatures: no-common-ligatures; color: #ffffff}span.s5 {font: 18.0px Menlo; font-variant-ligatures: no-common-ligatures}span.s6 {font-variant-ligatures: no-common-ligatures; color: #8b84cf}span.s7 {font: 18.0px Menlo; font-variant-ligatures: no-common-ligatures; color: #8b84cf}span.s8 {font: 18.0px 'Heiti SC Light'; font-variant-ligatures: no-common-ligatures; color: #ffffff}span.s9 {font: 18.0px Menlo; font-variant-ligatures: no-common-ligatures; color: #4cbf57}span.s10 {font: 18.0px Monaco; font-variant-ligatures: no-common-ligatures}span.s11 {font: 18.0px Menlo; font-variant-ligatures: no-common-ligatures; color: #c2349b}span.s12 {font-variant-ligatures: no-common-ligatures; color: #e44448}
// AFHTTPSessionManager *manager;
// manager.securityPolicy;//安全策略,https協(xié)議時(shí),若慢,或者失敗可改為no試試
tabview的樣式plain和grouped
UITableViewStylePlain
UITableViewStyleGrouped
@implementation XMGMeViewController
- (instancetype)init
{
return [self initWithStyle:UITableViewStyleGrouped];
}
pod --help
pod update --help
CocoaPods
- Podfile.lock文件
- 最后一次更新Pods時(shí), 所有第三方框架的版本號(hào)
- 常用指令的區(qū)別
- pod install
- 會(huì)根據(jù)Podfile.lock文件中列舉的版本號(hào)來安裝第三方框架
- 如果一開始Podfile.lock文件不存在, 就會(huì)按照Podfile文件列舉的版本號(hào)來安裝第三方框架
- 安裝框架之前, 默認(rèn)會(huì)執(zhí)行pod repo update指令
- pod update
- 將所有第三方框架更新到最新版本, 并且創(chuàng)建一個(gè)新的Podfile.lock文件
- 安裝框架之前, 默認(rèn)會(huì)執(zhí)行pod repo update指令
- pod install --no-repo-update
- pod update --no-repo-update
- 安裝框架之前, 不會(huì)執(zhí)行pod repo update指令
//不更新本地倉庫緩存,(本地倉庫緩存著第三方框架最新版本號(hào)備用)不更新相當(dāng)于離線加載安裝
x.m定義一個(gè)全局變量
y.h用extern聲明
其他文件只要import y.h就可以用在x.m中定義的全局變量
x,y沒什么關(guān)系,不需要相互包涵,也不能這么做..
當(dāng)然,名字一樣比較好所以XXX.h XXX.m
很多系統(tǒng)的分隔線,或者滑動(dòng)條都是一個(gè)UIImageVIew而已
解決tableView設(shè)置tableFooterView時(shí)contentSize不正確的問題
//在tableView設(shè)置時(shí)就會(huì)計(jì)算contentSize,tableFooterView在那一刻沒有高度,(延遲設(shè)置高度),contentSize不會(huì)計(jì)算FooterView的高度了,改FooterView指向newView,重新計(jì)算contentSize,但不正確,contentSize底部多20高度,
tableView.tableFooterView = footerView;
// 重新刷新數(shù)據(jù)(會(huì)重新計(jì)算contentSize)
[tableView reloadData];
查找字符串的常見方法
// 如果range.location == 0, 說明是以searchString開頭
// 如果range.location == NSNotFound或者range.length == 0, 說明沒找到對(duì)應(yīng)的字符串
//NSNotFound 無符號(hào)最大,擁有符號(hào)-1
static const NSInteger NSNotFound = NSIntegerMax;
- (NSRange)rangeOfString:(NSString *)searchString;
// 是否以str開頭
- (BOOL)hasPrefix:(NSString *)str;
// 是否以str結(jié)尾
- (BOOL)hasSuffix:(NSString *)str;
// 是否包含了str(不管頭部\中間\尾部)
- (BOOL)containsString:(NSString *)str;
計(jì)算總行數(shù)\總頁數(shù)
總數(shù) : 2476
每頁顯示的最大數(shù)量 : 35
總頁數(shù) : (2476 + 35 - 1) / 35
pagesCount = (總數(shù) + 每頁顯示的最大數(shù)量 - 1) / 每頁顯示的最大數(shù)量
總數(shù) : 1660
每一行顯示的最大數(shù)量 : 30
總行數(shù) : (1660 + 30 - 1) / 30
rowsCount = (總數(shù) + 每行顯示的最大數(shù)量 - 1) / 每行顯示的最大數(shù)量
// self.tableView.tableFooterView
// self.tableView.tableFooterView
self.tableView.sectionFooterHeight=10;
self.tableView.sectionHeaderHeight=0;
//A 單行注釋
/A/多行注釋
/*A/文檔注釋,只有文檔注釋才有解釋(敲方法時(shí),alt+單機(jī)有解釋)
frame.oringe,自己相對(duì)父控件而言.父控件坐標(biāo)系
bounds.oringe,自己相對(duì)內(nèi)容而言.內(nèi)容坐標(biāo)系(和contentoffsize一樣)
? alt+shfit +k
? alt+r
....
ò?ó???í??′‰ˇá¨??∏”ˉˉ????????????ˉ???úú????ˇá¨??∏”?óòú?????????????μ≤≤?˙˙???√∫μ≤≥÷÷≤∫√?≈ΩΩ????∑??¥??ππ““?“??§∞¢£??§??ao––≠?¥??????
warning 睡眠
// [NSThread sleepForTimeInterval:2.0];
// 設(shè)置cell默認(rèn)的文字(如果設(shè)置文字之前userInteractionEnabled=NO, 那么文字會(huì)自動(dòng)變成淺灰色)
self.textLabel.text = @"清除緩存(正在計(jì)算緩存大小...)";
控制器的view的y值默認(rèn)是20,,空出statusBar的高度?????
assign和weak的區(qū)別
- 本質(zhì)區(qū)別
- 速度比較: __unsafe_unretained > __weak
@property (nonatomic, assign) XMGDog *dog; // XMGDog *__unsafe_unretained _dog;
__unsafe_unretained的特點(diǎn):
1.不是強(qiáng)引用, 不能保住OC對(duì)象的命
2.如果引用的OC對(duì)象銷毀了, 指針并不會(huì)被自動(dòng)清空, 依然指向銷毀的對(duì)象(很容易產(chǎn)生野指針錯(cuò)誤: EXC_BAD_ACCESS)
@property (nonatomic, weak) XMGDog *dog; // XMGDog * _Nullable __weak _dog;
__weak的特點(diǎn):
1.不是強(qiáng)引用, 不能保住OC對(duì)象的命
2.如果引用的OC對(duì)象銷毀了, 指針會(huì)被自動(dòng)清空(變?yōu)閚il), 不再指向銷毀的對(duì)象(永遠(yuǎn)不會(huì)產(chǎn)生野指針錯(cuò)誤)
###
###在顏色的基礎(chǔ)上追加透明度
[[UIColor whiteColor] colorWithAlphaComponent:0.2];
// 獲取 名稱為TestXib的 nib
UINib *nib = [UINib nibWithNibName:@"TestXib" bundle:nil];
// 獲取TestXib 內(nèi)部的所有子控件 以數(shù)組的方法返回
NSArray *nibArray = [nib instantiateWithOwner:self options:nil];
NSArray *bundleArr = [[NSBundle mainBundle] loadNibNamed:@"TestXib" owner:self options:nil];
####計(jì)算字體size相關(guān)思想
計(jì)算text的size要傳入字體,要有串(兩個(gè)參數(shù)font,和字的個(gè)數(shù))
//這時(shí),當(dāng)它只是一行來算size
(三個(gè)參數(shù)font,和字的個(gè)數(shù),和排版限制高或?qū)?
要算多行的,還要一個(gè)參數(shù)限制寫入的串的最大寬度(高度限制為MAXFOALT就是不限制),或者限制最大高度(寬度不限),或者都限制
(一個(gè)參數(shù)font)
只是算高度(size.height),可以用font.lineHeigh屬性
####
UIKIT_EXTERN NSString *const UITextFieldTextDidBeginEditingNotification;
UIKIT_EXTERN NSString *const UITextFieldTextDidEndEditingNotification;
UIKIT_EXTERN NSString *const UITextFieldTextDidChangeNotification;