我正在创建一个应用程序,我想隐藏状态栏.当我测试应用程序时,状态栏会在显示启动画面时隐藏,但是一旦应用程序完全加载,状态栏就会重新出现.
我正在使用Xcode 5和iOS 7,并尝试以编程方式禁用状态栏
([[UIApplication sharedApplication] setStatusBarHidden:YES
withAnimation:UIStatusBarAnimationFade];),
Run Code Online (Sandbox Code Playgroud)
在info.plist文件中,并使用.xib文件上的属性检查器.什么都没有效果.
有任何想法吗?
在我使用Xcode 5 for iOS 7构建的iPhone应用程序UIViewControllerBasedStatusBarAppearance=YES中info.plist,我设置了ViewController这个代码:
-(UIStatusBarStyle) preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
Run Code Online (Sandbox Code Playgroud)
但状态栏在黑色背景下仍然是黑色的.
我知道它可以通过设置这个程序范围的更改UIViewControllerBasedStatusBarAppearance=NO在info.plist,但我确实需要改变这种对viewController由viewController基础在运行时.
我有一个ViewController在里面UINavigationcontroller,但导航栏是隐藏的.当我在iOS 7上运行应用程序时,状态栏显示在我的视图之上.有办法避免这种情况吗?
我不想编写任何特定于操作系统的代码.

我试着设置View controller-based status bar appearance到NO,但它并没有解决这个问题.
我正在以编程方式使用自动布局约束来布局我的自定义UITableView单元格,并且我正确地定义了单元格大小 tableView:heightForRowAtIndexPath:
它在iOS6上运行得很好,在iOS7中看起来也很好
但是当我在iOS7上运行应用程序时,这是我在控制台中看到的那种消息:
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2013-10-02 09:56:44.847 Vente-Exclusive[76306:a0b] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or …Run Code Online (Sandbox Code Playgroud) 我试图使用UITextView获得以下效果:

基本上我想在文本之间插入图像.图像可以简单地占用1行空间,因此不需要包装.
我尝试在子视图中添加一个UIView:
UIView *pictureView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 25, 25)];
[pictureView setBackgroundColor:[UIColor redColor]];
[self.textView addSubview:pictureView];
Run Code Online (Sandbox Code Playgroud)
但它似乎漂浮在文本上并覆盖它.
我在排除路径上做了一些阅读,这似乎是实现这一点的一种方式.但是,我不想绝对定位图像 - 相反,它应该与文本一起流动(类似于<span>HTML中的行为).
我只在iOS 7中收到此错误并且应用程序崩溃了.在iOS 6中,我从未收到任何错误,只是在打开相机时出现内存警告.
Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
Run Code Online (Sandbox Code Playgroud)
这就是我在做的事情.
imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setDelegate:self];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setAllowsEditing:YES];
[self presentModalViewController:imagePicker animated:YES];
Run Code Online (Sandbox Code Playgroud)
我确实试图延迟presentModalViewController,但我仍然得到相同的消息.几秒钟后(7-10),应用程序崩溃了.
此错误仅出现在iOS 7中.
有人有线索吗?先感谢您.
由于使用分组样式的表视图设计在iOS 7中发生了很大变化,我想隐藏(或删除)第一个节头.到目前为止,我还没有成功实现它.
有点简化,我的代码看起来像这样:
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (section == 0)
return 0.0f;
return 32.0f;
}
- (UIView*) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if (section == 0) {
UIView* view = [[UIView alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 640.0f, 0.0f)];
return view;
}
return nil;
}
- (NSString*) tableView:(UITableView *) tableView titleForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return nil;
} else {
// return some string here ...
}
}
Run Code Online (Sandbox Code Playgroud)
如果我返回0的高度,则永远不会使用截面索引0调用其他两个方法.但仍然使用默认高度绘制空截面标题.(在iOS 6中,调用了两种方法.但是,可见结果是相同的.)
如果我返回不同的值,则节标题将获得指定的高度.
如果我返回0.01,那几乎是正确的.但是,当我在模拟器中打开"颜色未对齐图像"时,它会标记所有表格视图单元格(这似乎是一个逻辑结果).
问题UITableView:从空部分隐藏标题的答案似乎表明有些人成功隐藏了部分标题.但它可能适用于普通样式(而不是分组样式).
到目前为止,最好的折衷方案是返回高度0.5,导致导航栏下方的线条稍微粗一些.但是,如果有人知道如何完全隐藏第一部分标题,我将不胜感激.
更新
根据 …
我正在使用Xcode 5的资产目录,我想用我LaunchImage作为我家视图的背景图像(这是一种非常常见的做法,使得从'加载'到'加载'的过渡看起来很流畅).
我想在资产目录中使用相同的条目来节省空间,而不必在两个不同的图像集中复制图像.
但是,致电:
UIImage *image = [UIImage imageNamed:@"LaunchImage"]; //returns nil
Run Code Online (Sandbox Code Playgroud) 刚刚将我的iPod touch升级到iOS 7.0.3并且"HelveticaNeue-Italic"似乎已经消失了.当我在手机上查询时:
[UIFont fontNamesForFamilyName:@"Helvetica Neue"]
Run Code Online (Sandbox Code Playgroud)
我得到以下fontNames(13):
HelveticaNeue-BoldItalic,
HelveticaNeue-Light,
HelveticaNeue-UltraLightItalic,
HelveticaNeue-CondensedBold,
HelveticaNeue-MediumItalic,
HelveticaNeue-Thin,
HelveticaNeue-Medium,
HelveticaNeue-ThinItalic,
HelveticaNeue-LightItalic,
HelveticaNeue-UltraLight,
HelveticaNeue-Bold,
HelveticaNeue,
HelveticaNeue-CondensedBlack
Run Code Online (Sandbox Code Playgroud)
当我在模拟器中运行相同的查询时,我得到(14):
HelveticaNeue-BoldItalic,
HelveticaNeue-Light,
**HelveticaNeue-Italic,**
HelveticaNeue-UltraLightItalic,
HelveticaNeue-CondensedBold,
HelveticaNeue-MediumItalic,
HelveticaNeue-Thin,
HelveticaNeue-Medium,
HelveticaNeue-Thin_Italic,
HelveticaNeue-LightItalic,
HelveticaNeue-UltraLight,
HelveticaNeue-Bold,
HelveticaNeue,
HelveticaNeue-CondensedBlack
Run Code Online (Sandbox Code Playgroud)
其他人都看到了吗?
- - 新的消息 - -
我回到WWDC 2013视频"使用带有文本工具包的字体",有趣的部分从12:22开始.演示者以OS X中的"MetaFonts"为例进行讨论.他说的是调用的字体如:
+ (NSFont *)messageFontOfSize:(CGFloat)fontSize
Run Code Online (Sandbox Code Playgroud)
不保证在版本甚至不同用途中返回相同的底层字体.他的榜样是Lucinda Grande.他似乎没有说使用"HelveticaNeue-Italic"可以从版本到版本.
所以我在iOS 7中构建了一个实验.我使用以下代码创建了我的字体:
UIFontDescriptor *fontDescriptor = [UIFontDescriptor fontDescriptorWithName:@"Helvetica Neue" size:16.0];
UIFontDescriptor *symbolicFontDescriptor = [fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitItalic];
UIFont *fontWithDescriptor = [UIFont fontWithDescriptor:symbolicFontDescriptor size:16.0];
Run Code Online (Sandbox Code Playgroud)
我确实为fontWithDescriptor获得了一个有效的UIFont,当我查询fontName的字体时:
[fontWithDescriptor fontName]
Run Code Online (Sandbox Code Playgroud)
我回来了...
HelveticaNeue-Italic
Run Code Online (Sandbox Code Playgroud)
去搞清楚???
所以7.0.3的可能答案似乎是上面的代码.
----进一步调整----
虽然解决方案在上面工作,但我认为它不是正式的.我已切换到以下解决方案
UIFontDescriptor *fontDescriptor …Run Code Online (Sandbox Code Playgroud) 使用Xcode 5 GM,只要我切换到5.1,6.0或6.1模拟器进行测试,我就会收到错误"iOS模拟器无法安装应用程序".当我重置模拟器它工作,但这变得非常累人.
有人有永久修复或解决方法吗?
ios7 ×10
ios ×6
xcode5 ×4
iphone ×2
statusbar ×2
uitableview ×2
xcode ×2
autolayout ×1
camera ×1
hidden ×1
objective-c ×1
textkit ×1
uifont ×1
uistatusbar ×1