在我的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)
它运行良好,但我不能再在父视图控制器中显示状态栏.
在Arc模式下集成ASIHTTPRequest库时会出现许多错误.是否有适当的方法来集成非弧库.
我已经把活动指标
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)
但是这没有在表视图中正确居中.因为表视图可以滚动.如何将微调器放在屏幕中央.
使用带有以下代码的自定义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:'
在导航栏下添加了 UISearch 栏。我用
[videoSearchBar setFrame:CGRectMake(0, 64, 320, 44)];
Run Code Online (Sandbox Code Playgroud)
对于 ios 7。
在横向模式下,导航栏和搜索栏之间存在间隙。在早期版本中,它在没有 setFrame 的情况下正确显示。
在搜索栏下方有一个表格视图。
我想在一个单独的线程中在后台运行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.对于这种情况,最好的方法是什么?
ios ×4
uitableview ×2
center ×1
concurrency ×1
ios7 ×1
show-hide ×1
statusbar ×1
uisearchbar ×1