cell重用的幾種方式,cell重用幾種方式1.使用xib重用 //ios6 之後推薦大家使用的重用方式 //動態使用self獲得當前類名,來作為唯一的標示 NSString * identifier = NSStringFromClass([self class]); UINib * nib = [UINib nibWithNibName:identifier
ObjC中怎麼判斷可變和不可變,objc判斷可變不可ObjC中怎麼判斷可變和不可變 怎麼判斷NSString和NSMutableString呢? 請聽題 BOOL result = [@"123" isKindOfClass:[NSMutableString class]]; // A:YES
頁面之間的跳轉效果,頁面跳轉效果-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ /* 1,不使用動畫 UIViewAnimationTransitionNone 2,從左向右旋轉翻頁 UIViewAnimationTransitionFlipFromLeft
數組內部對象排序(sort),數組對象排序sort1.數組排序有很多方法比如for,while迴圈去進行冒泡排序或者快速看、排序等多種排序方法 而我在這裡要說的是蘋果API提供的幾個系統方法 a.迭代器 Descriptor b.方法比較 Selector c.函數比較 Function d.塊代碼 Block自訂2.樣本
【代碼筆記】一個tableView,兩個section,tableviewsection一,。二,工程圖。三,代碼。RootViewController.h#import <UIKit/UIKit.h>@interface RootViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>{ UITableView
實現UITextView的placeholder,uitextview 我們知道在iOS開發時,控制項UITextField有個placeholder屬性,UITextField和UITextView使用方法基本類似,有兩個小區別:1.UITextField單行輸入,而UITextView可以多行輸入。2.UITextField有placeholder屬性,而UITextView沒有。至於兩者的代理方法,原理基本差不多,只是方法名略有差異。 &
【代碼筆記】正方形轉換,代碼筆記正方形一,工程圖。二,代碼。RootViewControlle.m//點擊任何處,頁面翻轉-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ FirstViewController *first=[[FirstViewController alloc]init]; CATransition *animation = [CATransition animation];
NSMutableParagraphStyle
長按文本全複製,文本複製 最近做一個長按文本複製全部內容的功能,在網上找了一個方法,使用起來很簡單,但是自己在使用的過程中出現了問題. 我的項目中文本控制項不是用的UILabel而是網上找的一個第三方架構OHAttributedLabel,其他的什麼就不多說了,主要寫寫我在其中遇見的問題吧.事先我給label設定了一個長按手勢,可是最終發現根本不執行相應的selector方法.最後發現是其中的一個重寫方法-(UIView *)hitTest:(CGPoint)point withEvent:
iOS中Git的使用,iOSGit使用開啟終端:查看Git的版本的終端命令:git —version 輸入:ssh查看是否已經存在ssh.如果存在,先將已有的ssh備份,或者將建立的ssh產生到另外的目錄下如果不存在,通過預設的參數直接產生ssh產生過程如下:ssh-keygen -t rsa -C XXXX@163.com(註冊Github時的email) 在github中添加ssh(示:)登入github,選擇Account
UIAlertController基本使用,uialertcontroller 從ios8之後,系統的彈框 UIAlertView 與 UIActionSheet 兩個並在一了起, 使用了一個新的控制器叫 UIAlertControllerUIAlertController的基本使用建立UIAlertControllerTitle:顯示的標題message:標題底部顯示的描述資訊preferredStyle:彈框的樣式 樣式分為兩種:
可以滾動的集合視圖,滾動集合視圖這個demo寫的是將集合視圖添加到滾動視圖中,實現可以滑動的效果。 ()1.建立視圖,定義集合視圖和滾動視圖 1 #import "ViewController.h" 2 #import "MyCollectionViewCell.h"//自訂的一個collectionViewCell 3 #define MainWidth [UIScreen mainScreen].bounds.size.width 4 #define
用UIBezierPath數組對UIView進行鏤空處理,uibezierpathuiview用UIBezierPath數組對UIView進行鏤空處理 效果 源碼//// CutOutClearView.h// CutOutMaskView//// Created by YouXianMing on 16/7/8.// Copyright © 2016年 YouXianMing. All rights reserved.//#import
修改NavigationBarItem的字型大小和顏色的使用方法,navigationbaritem //建立一個左邊按鈕 UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithTitle:@"<" style:UIBarButtonItemStylePlain target:self action:@selector(clickLeftButton)]; // leftButton.
一個很實用的,跳轉填寫 , 回來賦值.,很實用賦值//// IntextViewController.h// resume//// Created by on 16/7/1.// Copyright © 2016年 All rights reserved.//#import "BaseViewController.h"@interface IntextViewController : BaseViewController@property(nonatomic,strong)
【代碼筆記】獲得徐家匯的天氣預報,徐家匯天氣預報一,代碼。//獲得徐家匯的天氣預報-(void)getWeatherInfo{ NSError *error; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://m.weather.com.cn/data/101021200.html" ]];//代碼為徐家匯 NSData
九:UIView的拖拽,九:UIView拖拽 做出來效果:螢幕上的一塊UIView,點擊後能自由移動 1 #import "GreenView.h" 2 @implementation GreenView 3 - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 4 { 5 UITouch *touch = [touches anyObject]; 6 CGPoint
iOS 隱藏tabbar,ios隱藏tabbar -(void)viewWillAppear:(BOOL)animated{ NSArray *array=self.tabBarController.view.subviews; UIView *view=array[2]; view.frame=CGRectMake(0, [UIScreen mainScreen ].bounds.size.height, [UIScreen
【代碼筆記】旋轉的風扇,代碼筆記旋轉一,。二,工程圖。三,代碼。AppDelegate.m#import "AppDelegate.h"//加入標頭檔#import "RoundDiskViewController.h"@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
關於iOS上的靜態庫,iOS上靜態庫最近再進行項目的真機調試,然後發現了一個天坑。就此研究了一些iOS上的靜態庫的使用: 首先我們是直接拿一個可以啟動並執行項目來製作靜態庫的,網上大部分都是先建立靜態庫然後再寫內容,看看我的方法。 1.把子項目匯入到總項目工程裡面,然後刪除子項目的運行檔案,然後再裡面建立一個靜態庫!!!(不要建立framework那個,非常坑。我給坑了好久具體下面在說吧)建立一個.a的靜態庫。名字沒有什麼影響自己喜歡就可以,我一般是按照原來的名字來的。 2.然後在總項目工