真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

收集的常用有用代碼-創(chuàng)新互聯(lián)

* 給導(dǎo)航條加陰影

涼州網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司,涼州網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為涼州成百上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請找那個售后服務(wù)好的涼州做網(wǎng)站的公司定做!
if ([self.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]){
        [[UINavigationBar appearance] setBackgroundImage:[UIImage p_w_picpathNamed:@"head"] forBarMetrics:UIBarMetricsDefault];
        self.navigationBar.layer.masksToBounds = NO;
        //設(shè)置陰影的高度
        self.navigationBar.layer.shadowOffset = CGSizeMake(0, 3);
        //設(shè)置透明度
        self.navigationBar.layer.shadowOpacity = 0.6;
        self.navigationBar.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.navigationBar.bounds].CGPath;
    }


12.鍵盤透明

textField.keyboardAppearance = UIKeyboardAppearanceAlert;

狀態(tài)欄的網(wǎng)絡(luò)活動風(fēng)火輪是否旋轉(zhuǎn)

[UIApplication sharedApplication].networkActivityIndicatorVisible,默認值是NO。

13.截取屏幕圖片

//創(chuàng)建一個基于位圖的圖形上下文并指定大小為CGSizeMake(200,400)

UIGraphicsBeginImageContext(CGSizeMake(200,400));

//renderInContext 呈現(xiàn)接受者及其子范圍到指定的上下文

[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

//返回一個基于當(dāng)前圖形上下文的圖片

UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();

//移除棧頂?shù)幕诋?dāng)前位圖的圖形上下文

UIGraphicsEndImageContext();

//以png格式返回指定圖片的數(shù)據(jù)

p_w_picpathData = UIImagePNGRepresentation(aImage);

14.更改cell選中的背景

UIView *myview = [[UIView alloc] init];

myview.frame = CGRectMake(0, 0, 320, 47);

myview.backgroundColor = [UIColorcolorWithPatternImage:[UIImage p_w_picpathNamed:@"0006.png"]];

cell.selectedBackgroundView = myview;

2.圖片壓縮

用法:UIImage *yourImage= [self p_w_picpathWithImageSimple:p_w_picpath scaledToSize:CGSizeMake(210.0, 210.0)];

//壓縮圖片

- (UIImage*)p_w_picpathWithImageSimple:(UIImage*)p_w_picpath scaledToSize:(CGSize)newSize

{

// Create a graphics p_w_picpath context

UIGraphicsBeginImageContext(newSize);

// Tell the old p_w_picpath to draw in this newcontext, with the desired

// new size

[p_w_picpath drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];

// Get the new p_w_picpath from the context

UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();

// End the context

UIGraphicsEndImageContext();

// Return the new p_w_picpath.

return newImage;

}

3.親測可用的圖片上傳代碼

- (IBAction)uploadButton:(id)sender {

UIImage *p_w_picpath = [UIImage p_w_picpathNamed:@"1.jpg"]; //圖片名

NSData *p_w_picpathData = UIImageJPEGRepresentation(p_w_picpath,0.5);//壓縮比例

NSLog(@"字節(jié)數(shù):%i",[p_w_picpathData length]);

// post url

NSString *urlString = @"http://192.168.1.113:8090/text/UploadServlet";

//服務(wù)器地址

// setting up the request object now

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ;

[request setURL:[NSURL URLWithString:urlString]];

[request setHTTPMethod:@"POST"];

//

NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"];

NSString *contentType = [NSString stringWithFormat:@"multipart/form-data;boundary=%@",boundary];

[request addValue:contentType forHTTPHeaderField: @"Content-Type"];

//

NSMutableData *body = [NSMutableData data];

[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];

[body appendData:[[NSString  stringWithString:@"Content-Disposition:form-data; name=\"userfile\";  filename=\"2.png\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];  //上傳上去的圖片名字

[body appendData:[[NSString stringWithString:@"Content-Type:  application/octet-stream\r\n\r\n"]  dataUsingEncoding:NSUTF8StringEncoding]];

[body appendData:[NSData dataWithData:p_w_picpathData]];

[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];

[request setHTTPBody:body];

// NSLog(@"1-body:%@",body);

NSLog(@"2-request:%@",request);

NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];

NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];

NSLog(@"3-測試輸出:%@",returnString);

iOS開發(fā)之UIlabel多行文字自動換行 (自動折行)

UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(10, 100, 300, 180)];

UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 300, 150)];

label.text = @"Hello world! Hello world!Hello world! Hello world!  Hello world! Hello world! Hello world! Hello world!Hello world! Hello  world! Hello world! Hello world! Hello world! Helloworld!";

//背景顏色為紅色

label.backgroundColor = [UIColor redColor];

//設(shè)置字體顏色為白色

label.textColor = [UIColor whiteColor];

//文字居中顯示

label.textAlignment = UITextAlignmentCenter;

//自動折行設(shè)置

label.lineBreakMode = UILineBreakModeWordWrap;

label.numberOfLines = 0;

3、在程序中播放聲音:

首先在程序添加AudioToolbox:

收集的常用有用代碼

其次,在有播放聲音方法的.m方法添加#import:

#import

接下來,播放聲音的代碼如下:

NSString *path = [[NSBundle mainBundle] pathForResource:@"soundFileName" ofType:@"wav"];

SystemSoundID soundID;

AudioServicesCreateSystemSoundID ((__bridge CFURLRef)[NSURL fileURLWithPath:path], &soundID);

AudioServicesPlaySystemSound (soundID);

7、捕捉程序關(guān)閉或者進入后臺事件:

UIApplication *app = [UIApplication sharedApplication];

[[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(applicationWillResignActive:)  name:UIApplicationWillResignActiveNotification object:app];

applicationWillResignActive:這個方法中添加想要的操作

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


網(wǎng)頁題目:收集的常用有用代碼-創(chuàng)新互聯(lián)
文章鏈接:http://weahome.cn/article/dscjid.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部