04-08
现在在用storyboard拖拉界面。
1.崩溃 PassengerAcountViewController 0x7fdb78c29ed0> setValue:forUndefinedKey:]: this class is not key .....
http://q.cnblogs.com/q/36577/,忘记删除了storyboard里面的链接
2.push 不进去问题
解决方法:
添加约束文章
http://blog.youkuaiyun.com/pucker/article/details/41843511
04-09
storyboard 添加tableview问题
1.协议方法不走 tableview的datesource和delegate 没有和控制器关联(在控制器里写代码貌似不好用)
http://segmentfault.com/a/1190000000380380
添加scrollview
http://www.lanou3g.com/bbs/forum.php?mod=viewthread&tid=5193
04-11
UIView提供了大量管理视图的方法
//加一个视图到一个视图里面
addSubview:
//将一个视图移到前面
bringSubviewToFront:
//将一个视图推送到背后
sendSubviewToBack:
//把视图移除
removeFromSuperview
//插入视图 并指定索引
insertSubview:atIndex:
//插入视图在某个视图之上
insertSubview:aboveSubview:
//插入视图在某个视图之下
insertSubview:belowSubview:
//交换两个位置索引的视图
exchangeSubviewAtIndex:withSubviewAtIndex:
建立UIView动画块
CGContextRef context = UIGraphicsGetCurrentContext();
//标记动画开始
[UIView beginAnimations:nil context:context];
//定义动画加速或减速的方式
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//定义动画的时长 1秒
[UIView setAnimationDuration:1.0];
//中间处理 位置变化,大小变化,旋转,等等的
[[self.view viewWithTag:999] setAlpha:1.0f];
//标志动画块结束
[UIView commitAnimations];
//还可以设置回调
[UIView setAnimationDelegate:self];
//设置回调调用的方法
[UIView setAnimationDidStopSelector:@selector(animationFinished:)];
使用storyboard 报错
You own any object you create
You create an object using a method whose name begins with “alloc”, “new”, “copy”, or “mutableCopy” (for example, alloc
, newObject
, or mutableCopy
).
一定要注意命名规范,不能以alloc,new,copy,mutableCopy 作为开头命名,比如:newPassword,
04-17
iOS -[__NSCFConstantString size]: unrecognized selector sent to instance 0x10227a9c8
http://www.cnblogs.com/lisa090818/p/3401240.html
04-19
使用storyboard 给某个storyboard 添加storyboard Entry Point


04-20
提取本地json
NSData
* data=[
NSData
dataWithContentsOfFile
:[[
NSBundle
mainBundle
]
pathForResource
:
@"localobj"
ofType:@"json"]];
NSError* error;
NSDictionary
*localObj =[
NSJSONSerialization
JSONObjectWithData
:data
options
:
NSJSONReadingMutableContainers
error:&error];
04-22
键盘类型
http://blog.youkuaiyun.com/crazyzhang1990/article/details/39965931
04-27
UIGestureRecognizer是一个抽象类,定义了所有手势的基本行为,使用它的子类才能处理具体的手势。
<code class="hljs scss has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-function" style="box-sizing: border-box;">UITapGestureRecognizer(敲击)</span>
<span class="hljs-function" style="box-sizing: border-box;">UIPinchGestureRecognizer(捏合,用于缩放)</span>
<span class="hljs-function" style="box-sizing: border-box;">UIPanGestureRecognizer(拖拽)</span>
<span class="hljs-function" style="box-sizing: border-box;">UISwipeGestureRecognizer(轻扫)</span>
<span class="hljs-function" style="box-sizing: border-box;">UIRotationGestureRecognizer(旋转)</span>
<span class="hljs-function" style="box-sizing: border-box;">UILongPressGestureRecognizer(长按)</span></code><code class="hljs scss has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-function" style="box-sizing: border-box;"></span></code><h2 id="ios中的事件" style="margin: 0.8em 0px; padding: 0px; box-sizing: border-box; font-weight: 100; color: rgb(85, 85, 85); font-family: 'microsoft yahei'; line-height: 35px;">iOS中的事件</h2><p style="margin-top: 0px; margin-bottom: 1.1em; padding-top: 0px; padding-bottom: 0px; box-sizing: border-box; color: rgb(85, 85, 85); font-family: 'microsoft yahei'; font-size: 14px; line-height: 35px;">在用户使用app过程中,会产生各种各样的事件;iOS中的事件可以分为3大类型: <br style="box-sizing: border-box;" /><img src="https://img-blog.youkuaiyun.com/20150426194524663" alt="这里写图片描述" title="" style="border: none; box-sizing: border-box; max-width: 602px; height: auto;" /></p><p style="margin-top: 0px; margin-bottom: 1.1em; padding-top: 0px; padding-bottom: 0px; box-sizing: border-box; color: rgb(85, 85, 85); font-family: 'microsoft yahei'; font-size: 14px; line-height: 35px;">UIResponder内部提供了以下方法来处理事件</p><pre class="prettyprint" name="code" style="white-space: nowrap; word-wrap: break-word; box-sizing: border-box; margin-top: 0px; margin-bottom: 1.1em; font-family: 'Source Code Pro', monospace; padding: 5px 5px 5px 60px; font-size: 14px; line-height: 1.45; word-break: break-all; color: rgb(51, 51, 51); border: 1px solid rgba(128, 128, 128, 0.0745098); border-radius: 0px; position: relative; overflow-y: hidden; overflow-x: auto; background-color: rgba(128, 128, 128, 0.0470588);"><code class="hljs cs has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">/*触摸事件*/</span>
- (<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">void</span>)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">event</span>;
- (<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">void</span>)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">event</span>;
- (<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">void</span>)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">event</span>;
- (<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">void</span>)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">event</span>;</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>
这次主要是触摸事件,加速和远程控制事件可以先略过。
<code class="hljs erlang has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">加速计事件
<span class="hljs-pp" style="box-sizing: border-box;">- <span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(void)</span>motionBegan:<span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(<span class="hljs-variable" style="box-sizing: border-box;">UIEventSubtype</span>)</span>motion withEvent:<span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(<span class="hljs-variable" style="box-sizing: border-box;">UIEvent</span> *)</span>event;
- <span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(void)</span>motionEnded:<span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(<span class="hljs-variable" style="box-sizing: border-box;">UIEventSubtype</span>)</span>motion withEvent:<span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(<span class="hljs-variable" style="box-sizing: border-box;">UIEvent</span> *)</span>event;
- <span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(void)</span>motionCancelled:<span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(<span class="hljs-variable" style="box-sizing: border-box;">UIEventSubtype</span>)</span>motion withEvent:<span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(<span class="hljs-variable" style="box-sizing: border-box;">UIEvent</span> *)</span>event;</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>
<code class="hljs erlang has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">远程控制事件
<span class="hljs-pp" style="box-sizing: border-box;">- <span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(void)</span>remoteControlReceivedWithEvent:<span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(<span class="hljs-variable" style="box-sizing: border-box;">UIEvent</span> *)</span>event;</span></code>
手势使用:
http://blog.youkuaiyun.com/wangzi11322/article/details/45306711
04-28
利用UIWebView显示gif
NSString
*path = [[
NSBundle
mainBundle
]
pathForResource
:
@"3"
ofType
:
@"gif"
];
NSData *gifData = [NSData dataWithContentsOfFile:path];
[_webView loadData:gifData MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];
04-30
添加icon及给icon命名
http://www.th7.cn/Program/IOS/201409/283607.shtml