知識庫
加載一張圖片
UIImageView *imageView =[[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];
imageView.image=[UIImage imageNamed:@"22.png"];
[self.view addSubview:imageView];
彈出窗口
NSString *msg = @”f*au*ck U”;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@”message” message:msg delegate:self cancelButtonTitle:@”No” otherButtonTitles:@”Yes”, nil]; [alert show];
集成一個彈窗方法
NSString *a = [NSString stringWithFormat:@"group s %d",index];
[self alert:a];
字符串數字轉換
1,字符串拼接
NSString *newString = [NSString stringWithFormat:@"%@%@",tempA,tempB];
2,字符轉int
int intString = [newString intValue];
3,int轉字符
NSString *stringInt = [NSString stringWithFormat:@"%d",intString];
解決中文亂碼問題,POST也可以用,textfield也可以用的。
[NSString stringWithCString:[str UTF8String] encoding:NSUTF8StringEncoding];