iphone开发零碎知识汇总

1.xcode编译项目缓存路径:

~/Library/Developer/Xcode/DerivedData/'ProjectName-'+'randomcharacters'/Build/


2.iphone开发 地图线路

参考文章:http://hi.baidu.com/yunhuaikong/blog/item/02718e4fa46878d0d0c86a6b.html


3.代码添加UITab bar的图片文字

NSInteger index = 0;

while(index < 4){ // 4 is the number of tabbar items

        UINavigationController *navCtrlr = (UINavigationController*)[[tabBarController viewControllers] objectAtIndex:index];

        UITabBarItem *tabBar = (UITabBarItem *) navCtrlr.tabBarItem;

        if(index == 0){

        tabBar.image = [UIImage imageNamed:@"home-item.png"];

        tabBar.title = @"home";

    }

        ...

        index ++;

}

4.用代码向已有的UIViewController中添加UINavigationController


MyExampleViewController *vc = [[[MyExampleViewController alloc] initWithNibName:@"MyExample" bundle:nil] autorelease];
UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease];
[self presentModalViewController:navController animated:YES];

5.多个字符串连接

NSString* string; // 结果字符串
NSString* string1, string2; //已存在的字符串

1. string = [NSString initWithFormat:@"%@,%@", string1, string2 ];
2. string = [string1 stringByAppendingString:string2];
3 . string = [string stringByAppendingFormat:@"%@,%@",string1, string2];


这三种方法都会将string1和string2 合并,但是第二个方法更有效率

6.向iphone模拟器相册里添加图片方法:

从电脑里直接向模拟器拖一张图片,左键长按,保存即可

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值