iOS开发笔记

 

添加同一个控件多次到父控件,最终只会添加一个该控件

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

TableView中设置backgroundView,设置ImageView出不来?

因为target为7,设置图片只有8才可以

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1.url编码

ios中http请求遇到汉字的时候,需要转化成UTF-8,用到的方法是:

NSString * encodingString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

2.url解码

请求后,返回的数据,如何显示的是这样的格式:%3A%2F%2F,此时需要我们进行UTF-8解码,用到的方法是:

NSString *str = [model.album_name stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

dataSourceArray和reloadData都要在主线程中完成

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

*** Assertion failure in -[UITableView _dequeueReusableViewOfType:withIdentifier:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UITableView.m:6532

解决:因为使用的tableViewCell的xib绑定了identifier,如果注册时候不跟xib保持一致就会报错,或者是代码哪里写错了,仔细检查代码。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

后面带有UI_APPEARANE_SELECTOR的方法,都可以通过appearance统一设置

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IQKeyboardManager

键盘在切换textfield的时候出现顺序有误,跟添加textfield控件顺序有关,调整顺序即可解决

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

获取子View所在控制器

- (UIViewController *)viewController

{

    for (UIView* next = [self superview]; next; next = next.superview) {

        UIResponder *nextResponder = [next nextResponder];

        if ([nextResponder isKindOfClass:[UIViewController class]]) {

            return (UIViewController *)nextResponder;

        }

    }

    return nil;

}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This file is set to build for a version older than the project deployment target. Functionality may be limited.

解决方法:

选中xib 的文件,在 Builds for 中修改  Project Deployment Target

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

library not found for . . .

解决:.a文件未上传到服务器

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

libc++abi.dylib: terminate_handler unexpectedly threw an exception

2016.01.23

遇到了这个情况,发现是因为我从xib里拖出来的属性,被我改了名字导致

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

App installation failed

This application's application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed.

解决:

iPhone上已经装了包标识符一样的 App,删掉再运行。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

开发注意:

如果你建了一个类,比如:NCQRCodeViewController

那么你就不能在创建NCQRCodeView(包含xib)这样的类,否则会崩溃,原因是因为NCQRCodeViewController会先去找NCQRCodeView.xib,纳尼!就错在这儿了。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

ios9后打开百度、高德地图需要以下配置

在info.plist添加白名单

<key>LSApplicationQueriesSchemes</key>

<array>

     <string>baidumap</string>

     <string>iosamap</string>

</array>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

设置状态栏样式

1 修改info.plist文件,让UIApplication设置样式

添加 View controller-based status bar appearance  并设置为 NO

2 设置样式

在appdelegate中application.statusBarStyle = UIStatusBarStyleLightContent;

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Provisioning profile is expiring warning

~/Library/MobileDevice/Provisioning Profiles/

删除掉所有的profile在重新下载

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

directory not found for option '-L

解决方法: 

修改路径:选择项目名称----->Targets----->Build Settings----->Search Paths----->Library Search Paths

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

==15481==ERROR: AddressSanitizer: heap-buffer-overflow

edit scheme…->Run->Diagnostics->取消 Enable Address Sanitizer

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Scale:拉伸图片

Aspect:图片长宽的比例,保持图形的长宽比,保持图片不变形。

 

Aspect Fill:在保持长宽比的前提下,缩放图片,使图片充满容器。

Aspect Fit:在保持长宽比的前提下,缩放图片,使得图片在容器内完整显示出来。

Scale to Fill: 缩放图片,使图片充满容器。图片未必保持长宽比例协调,有可能会拉伸至变形。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

桌面图标通知

    // 注册推送, 用于iOS8以及iOS8之后的系统

    if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {

        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];

        [application registerUserNotificationSettings:settings];

    }

 

application.applicationIconBadgeNumber = 1;

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

The identity used to sign the executable is no longer valid.

步骤:

  1. 打开Xcode配置(Xcode -> Preferences...)
  2. 选择Accounts页面,选中你的Apple ID,点右下方的「View Detail...」按钮
  3. 点击左下角的刷新按钮,等待刷新完成,点「Done」按钮,关闭Xcode配置窗口
  4. 重新编译运行项目,若出现修复窗口,一路点「Fix Issue」按钮

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

设备的provis文件地址

/Users/mashangyouqian/Library/MobileDevice/Provisioning Profiles

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

 

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.  This will cause an exception in a future release

把需要更新UI的放在的主线程就好了

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

The identity used to sign the executable is no longer valid

删掉~/Library/MobileDevice/Provisioning Profiles/ 下所有文件, 在重新下载

下载:Xcode->Preference...->AppleID->ViewDetails->DownloadAll

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

-(void)viewWillDisappear:(BOOL)animated {

    [super viewWillDisappear:animated];

    // 开启系统返回手势

    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {

        self.navigationController.interactivePopGestureRecognizer.enabled = YES;

    }

}

- (void)viewDidAppear:(BOOL)animated {

    [super viewDidAppear:animated];

    // 禁用系统返回手势

    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {

        self.navigationController.interactivePopGestureRecognizer.enabled = NO;

    }

}

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

#pragma mark - tap和didSelect冲突解决

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

{

    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {

        // 如果返回NO,则gesture recognizer会忽略此触摸事件

        return NO;

    }

    return YES;

}

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

CUICatalog: Invalid asset name supplied: (null)

原因imageNamed为空

 

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

iOS项目工程,添加一个c文件,编译报错

解决方案:

将#import用包裹起来

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

svn 提交 is out of date

update

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

给 App 瘦身的另一个手段是提交 Bitcode 给 Apple,而不是最终的二进制。Bitcode 是 LLVM 的中间码,在编译器更新时,Apple 可以用你之前提交的 Bitcode 进行优化,这样你就不必在编译器更新后再次提交你的 app,也能享受到编译器改进所带来的好处。Bitcode 支持在新项目中是默认开启的,没有特别理由的话,你也不需要将它特意关掉。

 

视频 app 的画中画模式相对简单一些,如果你使用 AVPlayerLayer 来播放视频的话,那什么都不用做就已经支持了。但如果你之前选择的方案是 MPMoviePlayerViewController 的话,你可能也需要尽早迁移到 AVKit 的框架下来,因为 Media Player 将在 iOS 9 被标记为 deprecated 并不再继续维护。

 

滑动覆盖和分割视图的 app 会使用 iOS 8 引入的 Size Class 中的 Compact Width 和 Regular Height 的设定,配合上 AutoLayout 来进行布局。

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

通知只在主线程发送。

在init中注册,在dealloc中注销。

ghthouse是一个很好的错误追踪工具。OmniOutliner,我在这上面可以找到一堆事情去做。

如果你崩溃了,最好使用僵尸Zombies工具。

真实的代码质量远比别人怎么看我更重要。

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

The operation couldn’t be completed

退出Xcode重启

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

VVDocumenter-Xcode失效问题解决(如果这么弄都不行, 就删掉重来就OK)

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

在info.plist中添加

<key>NSAppTransportSecurity</key>

<dict>

    <key>NSAllowsArbitraryLoads</key>

    <true/>

</dict>

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

iOS - is missing from working copy

解决方案:

1.打开终端

2.cd 到警告所提示的文件夹下

3.执行命令svn rm --force 丢失文件的名称

4.回车

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

批量更新Xcode插件

find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  

懒加载的好处

1、直接使用即可,不用关心他怎么创建

2、保证他不空

3、业务逻辑清晰

 

UIPopoverController 详见02-UIPopoverController.pptx

 

layoutSubviews,如果不是根据自己的尺寸来算子控件的尺寸,那么该方法就没有作用

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Presenting view controllers on detached view controllers is discouraged <MyChargerViewController: 0x7fa84a4d4840>.

解决:

AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;

    [delegate.window.rootViewController presentViewController:self.loginNav animated:YES completion:nil];

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Unbalanced calls to begin/end appearance transitions for <TabBarController: 0x7fa84a515d00>.

解决:

进行视图跳转时,可能会遇到上面的警告日志,比如在loadView、viewDidLoad、viewWillAppear中,使用下面的代码:

AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;

    [delegate.window.rootViewController presentViewController:self.loginNav animated:YES completion:nil];

解决办法:

在viewDidAppear中执行上述代码即可;

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

 

在使用MJRefresh时返回可能会崩溃, 原因是在返回时需要在dealloc里执行[self.header free];[self.footer free]

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

找的时候可以通过在app运行时打印[NSBundle mainBundle]路径和NSHomeDirectory()发现具体路径。

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

对scrollView进行autolayout布局不好搞,使用tableviewcell替代较好

 

在cell的contentView里使用autolayout布局,最后一个布局不能使用尺寸布局

 

label的autolayout布局只需要设定位置和宽度就可以,高度系统帮我们算,也就意味着不用在使用bounding去计算高度了

 

插件路径:~/Library/Application Support/Developer/Shared/Xcode/Plug-ins

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

如果是其他格式转为mp3格式,该文件不能播放

wav:kAudioFormatLinearPCM

aac:kAudioFormatMPEG4AAC

caf:kAudioFormatLinearPCM、kAudioFormatAppleIMA4、kAudioFormatMPEG4AAC

m4a:kAudioFormatAppleLossless

自己录制的aac可以播放,安卓发的aac播放不了

自己录制的wac可以转成amr,但是不能播,转回wav能播,但是安卓发的amr转不了wav

安卓发送的amr、aac文件不能加载

 

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

如果tableview没有控制器,cell不要显示在状态栏下面:self.tableView.contentInset = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f);

 

Tableview底部不要显示没有内容的cell:self.tableView.tableFooterView = [[UIView alloc] init];

 

获得导航栏高度?控制器不要渗透在导航栏下面:self.edgesForExtendedLayout=UIRectEdgeNone;

 

打开Mac隐藏文件命令:defaults write com.apple.finder AppleShowAllFiles -bool true

关闭Mac隐藏文件命令:defaults write com.apple.finder AppleShowAllFiles -bool false

 

功能代码 在code4app找 或 在下载次数里找完整项目

完整项目 在github找

 

 

导航栏改不了 使用kvc:[self setValue:[[CusNavigationBar alloc] init] forkeyPath:@“navigationBar”];

 

adjustsImageWhenHighlighted//设置高亮的时候不要让图标变色

 

如果设置了select图片,在高亮状态下不会显示,这时覆盖setHighlight

 

Default-568@2x.png如果没有放在LaunchImage是不会自动加载的

 

 

 

Reflector 设备投影软件

 

/*

http://www.cocoachina.com/ios/20150130/11076.html

当旧的 iPhone 5 程序运行在 iPhone 6 上面,假如没有经过适配,旧程序自动等比放大,铺满新手机,旧程序也可以正常运行。这种方案可算是自动适配。但因为旧程序拉伸了,整体看起来有点虚,也不能更好利用大屏空间。

 

当需要开发者手动适配的时候,跟 iPhone 4 过渡到 iPhone 5 一样,在新程序中,指定一张新的启动图片。当指定了启动图,屏幕分辨率就已经变成应有的大小,这时候利用 AutoLayout 进行布局,同一份代码,就可以支持多个机型。新手机的屏幕更大,有更多的虚拟点,可以显示更多的内容。

 

值得注意一点是,iPhone 6 Plus。它的宽高是 414 × 736 个点,3x 模式,理想上来说,应该有 1242 × 2208 像素。但 iPhone 6 Plus 的实际像素是 1080 × 1920,是比理想值要少一点的。iPhone 6 Plus 的处理方式是将程序整体稍微缩小一点。分辨率很高,这点区别,实际上也看不出来。

*/

 

远程推送流程

推送是基于苹果的APNs服务器的,是因为如果用户把app关了,我们公司的服务器会与我们的app失去沟通,而苹果的APNs服务器始终与我们的设备保持长连接,那这样我们就只有借助苹果的APNs服务器完成推送

1.首先要获得设备的deviceToken

2.然后把deviceToken发给公司的服务器

3.由服务器,把deviceToken和推送的内容,交给苹果的APNs服务器

4.苹果的APNs服务器根据deviceToken,他就知道由哪一个应用推东西给哪一个设备

 

命令行冲突

(p)手动解决

(e)撤销更新操作,回去修改代码,相当于什么也没做

(mc)我的覆盖掉服务器的

(tc)服务器覆盖掉我的

(df)查看冲突

 

冲突解决方案:

1.df查看冲突,

2.p手动解决(会产生3个文件供查看,服务器前一个版本,服务器最新的版本,我的版本),解决冲突

3.resolved 文件,告诉服务器解决了冲突

 

回退

revert 只能对没有提交到服务器的代码恢复

解决回退已经提交的代码:

更新上一个版本,把刚提交的代码文件拷出来,在次更新到最新版本,把拷出来的代码在拷进去,在提交更新

 

 

 dispatch_once是线程安全的

200 OK

400 客户端语法错误,服务器无法解析

404 路径错误

500 服务器错误

 

charles下载地址:http://www.charlesproxy.com/download/

 

 

tmp : 不会备份,系统随时会被删除

Documents :会备份到iTunes

Library :preferences 会备份到iTunes

Library :caches 不会备份,不会被系统删除

 

多线程文件下载思路:

1首先创建一个等大小的空文件

2开多条线程分别去下载某一块,使用NSFileHandle插入

 

http支持断点下载,不支持断点上传

tcp/ip基于断点上传,基于socket

 

 

同步/异步决定了是否开启新的线程,同步在主线程执行任务,异步在子线程执行任务(特例:如果是主队列不会开启子线程)。异步是具备开线程的能力

串行/并发决定了执行任务的方式,串行是一个一个的执行任务,并发是同时执行任务。

 

凡是函数名带有create/copy/new/retain等字眼,都需要在不需要的时候进行release,如果在arc环境下release时报错,就不用写了。

 

主队列不管用同步还是异步都不会开线程

不能使用同步执行主队列任务,会导致任务无法往下执行

 

 

1.iPhone5分辨率320x568,像素640x1136,@2x

2.iPhone6分辨率375x667,像素750x1334,@2x

3.iPhone6 Plus分辨率414x736,像素1242x2208,@3x,(注意,在这个分辨率下渲染后,图像等比降低pixel分辨率至1080p(1080x1920)

 

 

 

Debug:调试版本,程序员用,会启动更多的服务来监控错误,速度比较慢

Release:发布版本,用户用,去掉那些繁琐的监控服务,运行速度快,节省内存

 

发布版本之前,在运行右边的项目名称->editScheme->run->info->Build Configuration 改为release测试一遍。静态库最好用release版本

 

内存分析工具

静态分析:不用运行程序分析

动态分析运行程序时分析

 

swift学习博客:www.cnblogs.com/yangfaxian/p/3765081.html

工具:

1crashlytics崩溃报告 

唐巧http://www.devtang.com/blog/2013/07/24/use-crashlytics/

2.github

3.simpholders快速打开应用沙盒

4.stackoverflow

 

音乐后台运行

1.appDelegate.m

- (void)applicationDidEnterBackground:(UIApplication *)application

{

    // 开启后台任务,让程序保持运行状态

    [application beginBackgroundTaskWithExpirationHandler:nil];

}

2.Info.plist

Required background modes ->item = App plays audio or streams audio/video using AirPlay

3. 设置音频会话类型

    AVAudioSession *session = [AVAudioSession sharedInstance];

    [session setCategory:AVAudioSessionCategorySoloAmbient error:nil];

    [session setActive:YES error:nil];

 

 

 

联合主键

id name

1 jack

1 jim

这样是可以的

 

select * from t_food f, t_food_type t where f.food_type_id = t.id and t.name = ‘鲁菜’;

select * from t_food f where f.food_type_id = (select t.id from t_food_type where t.name = ‘鲁菜’);

 

 

 

binary是二进制数据

MJExension 中 模型转字典的keyvalues如果属性是nil,就不转了

 

1.用户业务—> UserTool

2.加载用户个人信息—> userInfoWithParam:success:failure:

3.封装请求参数—> UserInfoParam

4.封装请求结果—> UserInfoResult

 

基本数据类型比对象性能高

请求参数用对象

返回用基本数据类型

 

添加异常断点,就是在哪里崩掉了就在哪里打个断点,点击左侧倒数第二个图标,点+选“add exception breakpoint”

 

 

按钮的title只要改动,该按钮的宽度就需要调整。重写setTitle方法,计算宽度。

 

-568h只支持Default-568h@2x.png

unassigned:不可用

 

 

 

设置cell的frame:重写setFrame方法,[super setFrame:frame]之前设置cell的frame

 

设置imageView的高亮图片:imageView.highlightedImage

 

微博时间处理:

1.今天

1分钟以内:刚刚

一个小时以内&至少1分钟:1分钟前

至少一个小时前:1小时前

2.昨天:昨天 12:00

3.前天或更早:05-09 12:00

4.非本年:2014-05-09 12:00

 

 

 

AirServer:真机投影

 

SDWebImage:假如在cell上显示图片,自己开线程去下载图片,会有非常非常多的细节要处理,为了减去这些不必要的麻烦,异步下载这个图片,我们通常用一个框架叫 SDWebImage。

 SDWebImage好处:1本地缓存,减省用户流量,2异步下载,3避免图片显示错误

 

AFNetworking:网络服务框架

 

KVC:会将字典所有key-value赋值给模型对应的属性

 

git管理已经创建好的项目

1.打开终端切换到项目:cd 项目路径

2.使用git进行初始化:git init 

3.把项目代码加到git里:git add .

4.提交代码到git里:git commit -m '初始化’ 

注释: -m代表全部 '’代表注释

 

 

返回一个不需要系统自动渲染的图片,也就是使用原始图片

[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]

 

 

 

imageView的图片是放在次层上显示的

 

ping 127.0.0.1 检测本地网卡是否正常

ping 192.168.1.105 检测网线是否正常

 

 

设置状态栏样式

1 修改info.plist文件,让UIApplication设置样式

添加 View controller-based status bar appearance  并设置为 NO

2 设置样式

在appdelegate中application.statusBarStyle = UIStatusBarStyleLightContent;

 

 

启动图片决定了窗口的大小

iOS7 有retain3.5 4.0英寸

iOS6 有retain3.5 4.0英寸 非retain3.5英寸

 

如果不用storyboard 【tableview dequeu… forIndexPath:] forIndexPath:就不用写了

 

 

事件的完整处理过程

1.先讲事件对象由上往下传递(由父控件传递给子控件),找到最合适的控件来处理这个事件。

2.调用最合适控件的touches方法。

3.如果调用了[super touches...]就会将事件顺着响应者链条往上传递,传递给上一个响应者

4.接着就会调用上一个响应者的touches方法

 

上一个响应者:

1.如果当前这个view是控制器view,那么控制器就是当前这个view的上一个响应者

2.如果当前这个view不是控制器view,那么当前这个view的父控件就是上一个响应者

 

什么是响应者链条

响应者链条是由多个响应者对象连接起来的链条

什么是响应者:能处理事件的对象

利用响应者链条,能让多个控件处理同一个触摸事件

怎么利用链条往上传递?上一个响应者

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

ios中remove references和move to trash的区别?remove references 只是删除引用 工程文件夹里面还是有这个文件的 move to trash 把文件从工程文件夹里扔进垃圾箱里了 .

 

快速修改本文件中所有的属性名技巧: 选中属性名后右击选中refactor -> rename

 

IOS中属性名不能以new开头

 

Xcode 中 iOS SDK 和 iOS Deployment Target 的设置: Base SDK 指的是,当前编译所用的SDK 版本; OS Deployment Target 指的是,编译后的 app 可在 终端的哪个 版本上运行。

 

 

写delegate的时候类型应该为weak弱引用,以避免循环引用,当delegate对象不存在后,我们写的delegate也就没有存在意义了自然是需要销毁的。@property (weak, nonatomic) id<MXCustomTabBarDelegate> delegate;

 

用XCode的Analyze可以分析到哪里有内存泄露。分析内存泄露不能把所有的内存泄露查出来,有的内存泄露是在运行时,用户操作时才产生的。那就需要用到Instruments了。

 

posted @ 2016-06-30 22:32  回读(IOS)  阅读(374)  评论(0编辑  收藏  举报