iOS学习笔记

2015.7.22

UINavigationBar添加按钮:

通过UIBarButtonItem的initWithCustomView创建一个按钮,并通过UIViewController的.navigationItem.rightBarButtonItem设置按钮

(target是UIViewController实例)

UIView *rightBarView = [targetgetRightBarView];

    if (rightBarView) {

        UIBarButtonItem *rightItem = [[UIBarButtonItemalloc]initWithCustomView:rightBarView];

        target.navigationItem.rightBarButtonItem = rightItem;

    }


2015.7.23

iOS 启动页面

直接把欢迎图片命名为 Default.png 就可以了。

http://blog.sina.com.cn/s/blog_74461f32010180it.html

代码注释

/**
  *  顶部公告btn
  */

会有注释提示。类似的:

/**顶部公告btn */

/**< 发送按钮 */

2015.7.27

sourcetree 链接git oschina。

1.   ssh-keygen -t rsa -C "heytrue@qq.com"

2.   将.ssh/id_rsa.pub添加到git oschina公钥

3.   ssh-add ~/.ssh

4.   ssh -T git@git.oschina.net

5.   git config --global user.name "zhuqiaochu"

6.   git config --global user.email "heytrue@qq.com"

使用sourcetree克隆到本地要用项目的ssh地址git@git.oschina.net:truestudio/XcodeTest.git而不是https地址,否则出错

2015.8.5

iOS无法获取sim卡信息,iOS5以后不能获取设备miei号。

2015.8.6

终于把ice objc 跑通了,记录一下。objc的版本是叫ice touch。

https://doc.zeroc.com/display/Ice36/Using+the+Ice+Touch+Binary+Distribution

按照官方文档,首先

Installing the Ice Touch binary distribution

使用 Homebrew, 在命令行输入:

brew tap zeroc-ice/tap
brew install icetouch36

然后

Setting up your OS X environment to use Ice Touch


https://github.com/zeroc-ice/ice-builder-xcode 下载Ice Builder for Xcode,直接用xcode打开运行就可以。

这样环境就建好了。

在需要ice的工程属性里Additional SDKs里加入

Objective-C SDK

/usr/local/IceTouch/ObjC/$(PLATFORM_NAME).sdk

C++ SDK

/usr/local/IceTouch/Cpp/$(PLATFORM_NAME).sdk

用objc就加入第一行的即可。

(修改,应为) /usr/local/lib/IceTouch/ObjC/$(PLATFORM_NAME).sdk

对于ice工程,只要把.ice文件加入到工程,编译时就会自动生成.h和.m文件。对于生成的.h和.m文件不必看其源码。

服务器端,需要在工程里创建新类,继承自生成的.h文件,并实现方法。import新类。

客户端不必继承,import .ice生成的.h文件



关于dispatch_async

http://blog.youkuaiyun.com/totogo2010/article/details/8016129

  1. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{  
  2.     // 耗时的操作  
  3.     dispatch_async(dispatch_get_main_queue(), ^{  
  4.         // 更新界面  
  5.     });  
  6. });  

2015.8.12

关于UIButton按下状态。

forState:UIControlStateSelected |UIControlStateHighlighted



2015.8.14

UITableView关于reloadDate crash

(建议看原帖)

http://www.cocoachina.com/bbs/read.php?tid=81462

问题的本质:在tableView的dataSource被改变 和 tableView的reloadData被调用之间有个时间差,而正是在这个期间,tableView的delegate方法被调用,如果新的dataSource的count小于原来的dataSource count,crash就很有可能发生了。

正确的方法:

dispatch_async(dispatch_get_main_queue(), ^{
        self.dataSourceArray= a new Array.
        [self.tableView reloadData];
});

===========

MJRefresh乃UITableview下拉刷新上拉加载的神器


2015.8.17

UILabel行距

    NSMutableAttributedString * attributedString1 = [[NSMutableAttributedStringalloc]initWithString:STR_SIGN_NOT];

    NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStylealloc]init];

    [paragraphStyle1 setLineSpacing:8];

    [attributedString1 addAttribute:NSParagraphStyleAttributeNamevalue:paragraphStyle1range:NSMakeRange(0, [STR_SIGN_NOTlength])];

    [_bindDetailLabelsetAttributedText:attributedString1];


2015.8.26

iOS 5.1(反正是5.几)以后无法通过openurl打开某个设置页面,iOS8.4可以通过

NSURL *settingsURL = [NSURLURLWithString:UIApplicationOpenSettingsURLString];

        [[UIApplicationsharedApplication]openURL:settingsURL];

进入设置根目录



iOS无法修改launchImage或者launchScreen.xib,也就是无法动态的修改启动页面,


http://stackoverflow.com/questions/16912754/change-the-launch-image-of-an-app-on-every-launch

The simple answer is NO you are not allowed to do this. This is because the image that you would have to modify is Default.png which is the launch image name which is located in the main bundle of the project, and it is not allowed to edit/amend/modify files in the main bundle of an iOS project.

This is because the contents of the main bundle are cryptographically (Think that's how it's spelt) signed as part of the Apple App store submission. So in modifying the contents within the main bundle could cause the application to stop running.


http://stackoverflow.com/questions/7015532/dynamically-change-launch-image-in-ios

The default image for an iphone app must be a fixed image file in your bundle. You cannot change it dynamically.

However, you can have a dynamic image that appears when the app loads after the launch image. You can set that up with animations or simply to select a random image each time.


关于设置本地保存目录

  • Put app-created support files in the Library/Application support/ directory. In general, this directory includes files that the app uses to run but that should remainhidden from the user. This directory can also include data files,configuration files, templates and modified versions of resources loaded from the app bundle.


2015.08.27

  • Default.png (iPhone)
  • Default@2x.png (iPhone Retina 3.5 inch)
  • Default@3x.png (iPhone 6 Plus landscape)
  • Default-568h@2x.png (iPhone Retina 4 inch)
  • Default-667h@2x.png (iPhone 6 portrait)
  • Default-Portrait.png (iPad in portrait orientation)
  • Default-Portrait@2x.png (iPad Retina in portrait orientation)
  • Default-Portrait@3x.png (iPhone 6 Plus portrait)
  • Default-Landscape.png (iPad in landscape orientation)
  • Default-Landscape@2x.png (iPad Retina in landscape orientation)

   320x480(2x) ->   640x960: Default@2x~iphone.png
   320x568(2x) ->  640x1136: Default-568h@2x~iphone.png
   375x667(2x) ->  750x1334: Default-667h@2x~iphone.png
   414x736(3x) -> 1242x2208: Default-736h@3x~iphone.png
  768x1024(1x) ->  768x1024: Default-Portrait~ipad.png
  1024x768(1x) ->  1024x768: Default-Landscape~ipad.png
  768x1024(2x) -> 1536x2048: Default-Portrait@2x~ipad.png
  1024x768(2x) -> 2048x1536: Default-Landscape@2x~ipad.png

2015.08.28

resizableImageWithCapInsets 使图片成为类似android的9patch

http://my.oschina.net/u/557242/blog/185535

上面所提及的capinsets的单位是point而非pixel,在高清的情况下1point等于2pixel。(@2x)


2015.09.10

static 变量 可能会被编译器优化,函数调用参数用到static有可能尚未被赋值


2015.09.21

c++ 指针成员变量在new之前似乎应该赋值为NULL,不然new会出错..


内容概要:《2024年中国城市低空经济发展指数报告》由36氪研究院发布,指出低空经济作为新质生产力的代表,已成为中国经济新的增长点。报告从发展环境、资金投入、创新能力、基础支撑和发展成效五个维度构建了综合指数评价体系,评估了全国重点城市的低空经济发展状况。北京和深圳在总指数中名列前茅,分别以91.26和84.53的得分领先,展现出强大的资金投入、创新能力和基础支撑。低空经济主要涉及无人机、eVTOL(电动垂直起降飞行器)和直升机等产品,广泛应用于农业、物流、交通、应急救援等领域。政策支持、市场需求和技术进步共同推动了低空经济的快速发展,预计到2026年市场规模将突破万亿元。 适用人群:对低空经济发展感兴趣的政策制定者、投资者、企业和研究人员。 使用场景及目标:①了解低空经济的定义、分类和发展驱动力;②掌握低空经济的主要应用场景和市场规模预测;③评估各城市在低空经济发展中的表现和潜力;④为政策制定、投资决策和企业发展提供参考依据。 其他说明:报告强调了政策监管、产业生态建设和区域融合错位的重要性,提出了加强法律法规建设、人才储备和基础设施建设等建议。低空经济正加速向网络化、智能化、规模化和集聚化方向发展,各地应找准自身比较优势,实现差异化发展。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值