iOS开发遇到问题汇总(一)

来源:互联网 发布:windows iso怎么安装 编辑:程序博客网 时间:2024/05/22 11:53


1.在使用tableview来显示的时候,如果定义的行数比较多而内容比较少,比如一页中只显示了一个或者两个内容,而tableview的行数肯定不会只有这么两行,因此下面多余的行数就会显示出来。 如下图

解决方案 很简单:

 在tableview初始化的时侯 设置 self.tableview.tableFooterView = [[UIViewalloc]init];

只需要初始化一个 就行了 不需要做其他操作。

还有一种解决方案是 隐藏系统带的 分割线。自己画分割线。

2。在应用启动中出现Could not load NIB in bundle: 'NSBundle </private/var/mobile/Containers/Bundle/Application/C960769D-7953-479B-B1C3-812807813A1F/XXXX.app> (loaded)' with name 'LaunchScreen''

解决方案:

添加launchscreen。

3.横竖屏全部用 vfl + al 搞定
4.OC与js交互
http://www.skyfox.org/javascript-ios-navive-message.html
5.让subview响应区域超过superview frame的方法
 -(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event,这个方法

6。刚点击进去是正常的,选择一个筛选条件进二级再返回,上面就空了64像素
self.automaticallyAdjustsScrollViewInsets = NO;
7,block 有时候断点 不还追踪代码
断点本来就不适合调线程的
8.基于opencv的银行卡识别
http://www.docin.com/p-1158543408.html
9.
iOS网络请求AFNetworking "Request failed: unacceptable content-type: text/html"

_sharedClient.responseSerializer.acceptableContentTypes=[NSSetsetWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain",nil];

acceptableContentTypes 为NSSet如果缺后台对应的content-type,可以直接添加进去


所有的ContentTypes都包含在http://www.iana.org/assignments/media-types/media-types.xhtml中
10.去除searchbar 的背景
for (UIView *view in self.searchBar.subviews) {
    // for before iOS7.0
    if ([view isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
        [view removeFromSuperview];
        break;
    }
    // for later iOS7.0(include)
    if ([view isKindOfClass:NSClassFromString(@"UIView")] && view.subviews.count > 0) {
        [[view.subviews objectAtIndex:0] removeFromSuperview];
        break;
    }



0 0
原创粉丝点击