首页 > 技术文章 > Object-c 语言

kuangwu 2013-09-10 11:19 原文

字符串操作:

http://www.myexception.cn/mobile/455287.html

1,判断两字符串是否相同

NSString *str1 = @"hello pepe";   
NSString *str2=[NSString stringWithFormat:@"hello %s","pepe"];
if([str1 isEqualToString:str2]){
NSLog(@"相同");
}
else{
NSLog(@"不同");
}

2,浮点型运算

  CGRect screenRect=[UIScreenmainScreen].bounds;

CGFloat widthf= (screenRect.size.height-self.adView.frame.size.width)/2;

CGFloat heighf=screenRect.size.width-self.adView.frame.size.height-50.0f;

推荐阅读