小编Sus*_*tha的帖子

如何隐藏iOS状态栏

在我的iOS视频应用中,状态栏隐藏在某些视图控制器中.我使用以下代码完成了此操作.

[[UIApplication sharedApplication] setStatusBarHidden:YES];
Run Code Online (Sandbox Code Playgroud)
  • 它适用于iOS 5和iOS 6,但不适用于iOS 7.

  • 我在特定的视图控制器中试过这个,

例如:

-(BOOL)prefersStatusBarHidden { return YES; }
Run Code Online (Sandbox Code Playgroud)

它运行良好,但我不能再在父视图控制器中显示状态栏.

statusbar show-hide ios7

217
推荐指数
16
解决办法
18万
查看次数

如何在ARC中集成ASIHTTPRequest

在Arc模式下集成ASIHTTPRequest库时会出现许多错误.是否有适当的方法来集成非弧库.

asihttprequest ios automatic-ref-counting

5
推荐指数
2
解决办法
6736
查看次数

如何将activityindicator置于tableview的中间位置

我已经把活动指标

 spinner.center = CGPointMake( [UIScreen mainScreen].bounds.size.width/2,[UIScreen mainScreen].bounds.size.height/2);
[self.view addSubview:spinner];
Run Code Online (Sandbox Code Playgroud)

但是这没有在表视图中正确居中.因为表视图可以滚动.如何将微调器放在屏幕中央.

center uitableview uiactivityindicatorview ios

5
推荐指数
1
解决办法
6649
查看次数

UITableView dataSource必须从tableView返回一个单元格:cellForRowAtIndexPath/Assertion失败消息

使用带有以下代码的自定义UITableViewCell实现UITableView

    @interface ProfileSaveViewController : UITableViewController
     {
         UITableViewCell *cell0;
         UITableViewCell *cell1;
         UITableViewCell *cell2;
         UILabel *cell2Label;
     }

    @property (nonatomic, retain) IBOutlet UITableViewCell *cell0;
    @property (nonatomic, retain) IBOutlet UITableViewCell *cell1;
    @property (nonatomic, retain) IBOutlet UITableViewCell *cell2;
    @property (nonatomic, retain) IBOutlet UILabel *cell2Label;

    @end

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:               (NSIndexPath*)indexPath
  {
        if([indexPath row] == 0) return cell0;
        if([indexPath row] == 1) return cell1;
        if([indexPath row] == 2) return cell2;   
        return nil;
  }
Run Code Online (Sandbox Code Playgroud)

运行应用程序时出现以下消息.

*断言失败 - [UITableView _createPreparedCellForGlobalRow:withIndexPath:],/ SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:6072 2012-03-01 11:11:31.984 TestSplitView [765:f803]*由于未捕获的异常而终止应用'NSInternalInconsistencyException',原因:'UITableView dataSource必须从tableView返回一个单元:cellForRowAtIndexPath:'

uitableview

4
推荐指数
1
解决办法
1万
查看次数

当设备处于横向时,UISearchBar 不附带导航栏

在导航栏下添加了 UISearch 栏。我用

 [videoSearchBar  setFrame:CGRectMake(0, 64, 320, 44)]; 
Run Code Online (Sandbox Code Playgroud)

对于 ios 7。

在横向模式下,导航栏和搜索栏之间存在间隙。在早期版本中,它在没有 setFrame 的情况下正确显示。

在搜索栏下方有一个表格视图。

uisearchbar screen-orientation ios

2
推荐指数
1
解决办法
1124
查看次数

如何在后台线程iOS中运行进程

我想在一个单独的线程中在后台运行6秒后运行任务.我用这个代码.

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 6 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
            [self getUnsyncNamesFromServer];
}
Run Code Online (Sandbox Code Playgroud)

我不确定这是在后台线程中运行的.我是否需要为此目的使用dispatch_async.对于这种情况,最好的方法是什么?

concurrency multithreading background-process ios

2
推荐指数
1
解决办法
5502
查看次数