去除nsstring中的空格
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSString *username = [mUsernameField stringValue];
username = [username stringByTrimmingCharactersInSet:whitespace];
讓覆蓋在下面層的視圖接受觸摸事件
searchImage.exclusiveTouch = YES;//第一層
searchImage.userInteractionEnabled = NO;
myMapView.exclusiveTouch = NO;//第二層
myMapView.userInteractionEnabled = YES;
防止屏幕暗掉鎖屏
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
狀態(tài)欄的網(wǎng)絡(luò)活動(dòng)風(fēng)火輪是否旋轉(zhuǎn)
[UIApplication sharedApplication].networkActivityIndicatorVisible,默認(rèn)值是NO。
鍵盤透明
textField.keyboardAppearance = UIKeyboardAppearanceAlert;
截取屏幕圖片
//創(chuàng)建一個(gè)基于位圖的圖形上下文并指定大小為CGSizeMake(200,400)
UIGraphicsBeginImageContext(CGSizeMake(200,400));
//renderInContext 呈現(xiàn)接受者及其子范圍到指定的上下文
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
//返回一個(gè)基于當(dāng)前圖形上下文的圖片
UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();
//移除棧頂?shù)幕诋?dāng)前位圖的圖形上下文
UIGraphicsEndImageContext();
//以png格式返回指定圖片的數(shù)據(jù)
imageData = UIImagePNGRepresentation(aImage);
更改cell選中的背景
UIView *myview = [[UIView alloc] init];
myview.frame = CGRectMake(0, 0, 320, 47);
myview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"0006.png"]];
cell.selectedBackgroundView = myview;
從本地加載圖片
NSString *boundle = [[NSBundle mainBundle] resourcePath];
[web1 loadHTMLString:[NSString stringWithFormat:@"<img src='http://fei263.blog.163.com/blog/0001.png'/>"] baseURL:[NSURL fileURLWithPath:boundle]];
View自己調(diào)用自己的方法:
[self performSelector:@selector(loginToNext) withObject:nil afterDelay:2];//黃色段為方法名,和延遲幾秒執(zhí)行.
動(dòng)畫:一個(gè)接一個(gè)地顯示一系列的圖象
NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.gif"], nil];
UIImageView *myAnimatedView = [UIImageView alloc];
[myAnimatedView initWithFrame:[self bounds]];
myAnimatedView.animationImages = myImages; //animationImages屬性返回一個(gè)存放動(dòng)畫圖片的數(shù)組
myAnimatedView.animationDuration = 0.25; //瀏覽整個(gè)圖片一次所用的時(shí)間
myAnimatedView.animationRepeatCount = 0; // 0 = loops forever 動(dòng)畫重復(fù)次數(shù)
[myAnimatedView startAnimating];
[self addSubview:myAnimatedView];
[myAnimatedView release];
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSString *username = [mUsernameField stringValue];
username = [username stringByTrimmingCharactersInSet:whitespace];
讓覆蓋在下面層的視圖接受觸摸事件
searchImage.exclusiveTouch = YES;//第一層
searchImage.userInteractionEnabled = NO;
myMapView.exclusiveTouch = NO;//第二層
myMapView.userInteractionEnabled = YES;
防止屏幕暗掉鎖屏
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
狀態(tài)欄的網(wǎng)絡(luò)活動(dòng)風(fēng)火輪是否旋轉(zhuǎn)
[UIApplication sharedApplication].networkActivityIndicatorVisible,默認(rèn)值是NO。
鍵盤透明
textField.keyboardAppearance = UIKeyboardAppearanceAlert;
截取屏幕圖片
//創(chuàng)建一個(gè)基于位圖的圖形上下文并指定大小為CGSizeMake(200,400)
UIGraphicsBeginImageContext(CGSizeMake(200,400));
//renderInContext 呈現(xiàn)接受者及其子范圍到指定的上下文
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
//返回一個(gè)基于當(dāng)前圖形上下文的圖片
UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();
//移除棧頂?shù)幕诋?dāng)前位圖的圖形上下文
UIGraphicsEndImageContext();
//以png格式返回指定圖片的數(shù)據(jù)
imageData = UIImagePNGRepresentation(aImage);
更改cell選中的背景
UIView *myview = [[UIView alloc] init];
myview.frame = CGRectMake(0, 0, 320, 47);
myview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"0006.png"]];
cell.selectedBackgroundView = myview;
從本地加載圖片
NSString *boundle = [[NSBundle mainBundle] resourcePath];
[web1 loadHTMLString:[NSString stringWithFormat:@"<img src='http://fei263.blog.163.com/blog/0001.png'/>"] baseURL:[NSURL fileURLWithPath:boundle]];
View自己調(diào)用自己的方法:
[self performSelector:@selector(loginToNext) withObject:nil afterDelay:2];//黃色段為方法名,和延遲幾秒執(zhí)行.
動(dòng)畫:一個(gè)接一個(gè)地顯示一系列的圖象
NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.gif"], nil];
UIImageView *myAnimatedView = [UIImageView alloc];
[myAnimatedView initWithFrame:[self bounds]];
myAnimatedView.animationImages = myImages; //animationImages屬性返回一個(gè)存放動(dòng)畫圖片的數(shù)組
myAnimatedView.animationDuration = 0.25; //瀏覽整個(gè)圖片一次所用的時(shí)間
myAnimatedView.animationRepeatCount = 0; // 0 = loops forever 動(dòng)畫重復(fù)次數(shù)
[myAnimatedView startAnimating];
[self addSubview:myAnimatedView];
[myAnimatedView release];