iOS-BaseConfig-工程基礎配置

來源:互聯網
上載者:User

標籤:判斷   tla   out   顯示   div      更改   ram   stat   

1> iOS 真機測試包路徑:

點擊->前往->前往檔案夾 : /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport

2> 超級標頭檔Pch 配置:Build Settings ->prefix header :$(SRCROOT)/工程名/類名

3>

[_filterBgView addSubview:_hobbyBtn,_interestBtn,_classifyBtn];//分類、興趣、愛好- (void)filterClickEvent:(UIButton*)sender {    sender.selected = !sender.selected;    if (sender.selected == YES) {        for (UIButton *button in self.filterBgView.subviews) {            button.selected = NO;            sender.selected = YES;        }    }    if (sender.tag == kClassify_TAG) {        if (sender.selected) {            NSLog(@"全部分類展開");        }else {            NSLog(@"全部分類關閉");        }    }else if (sender.tag == kInterest_TAG) {        if (sender.selected) {            NSLog(@"全部興趣展開");        }else {            NSLog(@"全部興趣關閉");        }    }else if (sender.tag == kHobby_TAG) {        if (sender.selected) {            NSLog(@"全部愛好展開");        }else {            NSLog(@"智能愛好關閉");        }    }    [self isShowTopView:sender.selected];}5.YYText修改加入圖片後文字 變小的問題//建立最主要的attribute文本    NSMutableAttributedString *contentText = [[NSMutableAttributedString alloc] initWithAttributedString:_momentIdea.attributedText];    contentText.yy_font = [UIFont systemFontOfSize:32*uiScale];self.navigationItem.title > self.title>self.tabBarItem.title只要設定self.title,那麼self.navigationItem.title和self.tabBarItem.title值不管設定與否都和self.title一致。 tabBarItem.title  設定1. TabBarVC 建立每個子Nav控制器的時候設定有效 CHNavBillVC *navBillCtr = [[CHNavBillVC alloc] initWithRootViewController:viewVC]; navBillCtr.tabBarItem.title = @”賬單”; //設定標題 2. 每個子Nav控制的viewDidLoad裡設定無效 viewWillAppear裡設定有效self.tabBarItem.title = @“賬單1”; 3. 每個子Nav控制器的根控制器裡viewDidLoad裡可以設定 self.title = @”賬單2″ self.tabBarItem.title = @“tabBar的title”; //這樣設定無效 優先順序: 3 > 2 > 1 即同時設定的話, 顯示優先順序高的內容 重點: 在每個子Nav控制器的根控制器裡 self.title可以控制tabBarItem的titlenavigationItem.title 設定1.TabBarVC 建立每個子Nav控制器的時候設定無效 CHNavBillVC *navBillCtr = [[CHNavBillVC alloc] initWithRootViewController:viewVC]; navBillCtr.navigationItem.title = @“Nav”; //無效 2.每個子Nav控制的viewDidLoad, viewWillAppear裡設定都無效 self.navigationItem.title = @“賬單”; //都無效 3.每個子Nav控制器的根控制器裡viewDidLoad裡可以設定 self.title = @“”; self.navigationItem.title = @”dsadsa”; 優先順序:只有3可以設定, 但self.navigationItem.title > self.title, 所以這種優先順序可以完成tabBarItem.title和navigationItem.tiltle不一樣的顯示7.setNeedsDisplay和setNeedsLayout ,layOutSubViewslayOutSubViews:改變布局可以在自己定製的視圖中重載這個方法,用來調整子視圖的尺寸和位置。UIView的setNeedsDisplay和setNeedsLayout首先兩個方法都是非同步執行的。setNeedsDisplay會調用自動調用drawRect方法,這樣可以拿到UIGraphicsGetCurrentContext,就可以畫畫 了。setNeedsLayout會預設調用layoutSubViews,就可以處理子視圖中的一些資料。綜上所述:setNeedsDisplay方便繪圖,而layoutSubViews方便出來資料setNeedDisplay告知視圖它發生了改變,需要重新繪製自身,就相當於重新整理介面.layoutSubViews&drawRectslayoutSubviews在以下情況下會被調用:    ?    1、init初始化不會觸發layoutSubviews。    ?    2、addSubview會觸發layoutSubviews。    ?    3、設定view的Frame會觸發layoutSubviews,當然前提是frame的值設定前後發生了變化。    ?    4、滾動一個UIScrollView會觸發layoutSubviews。    ?    5、旋轉Screen會觸發父UIView上的layoutSubviews事件。    ?    6、改變一個UIView大小的時候也會觸發父UIView上的layoutSubviews事件。    ?    7、直接調用setLayoutSubviews。drawRect在以下情況下會被調用:    ?    1、如果在UIView初始化時沒有設定rect大小,將直接導致drawRect不被自動調用。drawRect 掉用是在Controller->loadView, Controller->viewDidLoad 兩方法之後掉用的.所以不用擔心在 控制器中,這些View的drawRect就開始畫了.這樣可以在控制器中設定一些值給View(如果這些View draw的時候需要用到某些變數 值).    ?    2、該方法在調用sizeToFit後被調用,所以可以先調用sizeToFit計算出size。然後系統自動調用drawRect:方法。    ?    3、通過設定contentMode屬性值為UIViewContentModeRedraw。那麼將在每次設定或更改frame的時候自動調用drawRect:。    ?    4、直接調用setNeedsDisplay,或者setNeedsDisplayInRect:觸發drawRect:,但是有個前提條件是rect不能為0。8.Pop 回上一介面時,移除導航控制器【棧】裡面的視圖VCNSMutableArray *a = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];        for (UIViewController *vc in a) {            if ([vc isKindOfClass:[XBNewLoginViewController class]]) {                [a removeObject:vc];                self.navigationController.viewControllers = a;                break;            }         }9.判斷當前介面是present還是push過來的    NSArray *viewcontrollers=self.navigationController.viewControllers;    if (viewcontrollers.count>1) {        if ([viewcontrollers objectAtIndex:viewcontrollers.count-1]==self) {            //push方式            [self.navigationController popViewControllerAnimated:YES];        }    }else{        //present方式        [self.navigationController dismissViewControllerAnimated:YES completion:nil];    }9.如何使CollectionView整體上移  Set setContentOffset  if (option==XBMemberExchangeCodeReceiveNotiState) {        [_collectionView setContentOffset:CGPointMake(0, +500*suitScale) animated:YES];    }else if (option==XBMemberExchangeCodeDisappearState){        [_collectionView setContentOffset:CGPointMake(0, -128*suitScale) animated:YES];     }

 

iOS-BaseConfig-工程基礎配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.