浮點數處理並去掉多餘的0,浮點數代碼:- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. NSLog(@"--float-%@-",[self stringDisposeWithFloat:9.000899990000]); }//浮點數處理並去掉多餘的0-(NSString
將400電話中間加上-線,400電話-線代碼:- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. NSLog(@"--iphone--%@",[self getNewPhoneStr1:@"18502368888"]); }//只需傳一個電話進去,可以返回一個處理好的加了-線的400電話字串,如傳4001234567,返回400-1
通過顏色來產生一個純色的圖片,產生純色圖片 :代碼:- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)];
UIAlertView自動半閉,UIAlertView半閉 : 代碼:- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. //alert UIAlertView *alert=[[UIAlertView alloc]initWithTitle:nil message:@"一個可以自動關閉的Alert視窗"
UITextField設定placeholder顏色,uitextfield:代碼:- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. UITextField *textField=[[UITextField alloc]initWithFrame:CGRectMake(50, 100, 200, 50)];
檢測手機翻轉,手機翻轉代碼:- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. //監聽手機方向改變事件 [[NSNotificationCenter defaultCenter] addObserver:self