Tag: ios7

强制滚动后,cellForItemAtIndexPath返回nil使其可见

所以我试图写一些代码滚动集合视图到一个特定的索引,然后拉引用到单元格,并做一些逻辑。 不过,我注意到,如果该单元格在滚动之前目前不可见,则cellForItemAtIndexPath调用将返回nil,导致我的逻辑的其余部分失败。 [_myView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0] atScrollPosition:UICollectionViewScrollPositionTop animated:NO]; //Tried with and without this line, thinking maybe this would trigger a redraw [_myView reloadData]; //returns nil if cell was off-screen before scroll UICollectionViewCell *cell = [_myView cellForItemAtIndexPath: [NSIndexPath indexPathForItem:index inSection:0]]; 有没有其他的方法,我必须调用导致cellForItemAtIndexPath返回一个单元格突然进入视图作为滚动的结果之前立即它的东西?

是否有可能在SpriteKit的任意点周围旋转节点?

有没有办法在一个任意的点周围SpriteKit中的节点旋转? 我现在可以操作节点的anchorPoint ,但是如果我想要使用的旋转点位于节点之外,这还不够。 在SpriteKit中实现这种旋转的最佳方式是什么?

如何在ios中为UITextView设置内容embedded

我有一个UITextView和设置内容插入为 [atextView setContentInset:UIEdgeInsetsMake(0, 10, 0, 0)]; 此代码在iOS 6.1及以下版本中工作,但在iOS 7.0中没有任何反应。

自动布局约束更改不animation

我正在学习教程中的animation自动布局 http://weblog.invasivecode.com/post/42362079291/auto-layout-and-core-animation-auto-layout-was 事情正在完善。 当我尝试在我的应用程序中使用这个概念时,试图从底部到顶部设置一个设置屏幕(UIView)的animation,当设置屏幕只是一个空的UIView时, 但是,如果我添加一个UILabel作为子视图到这个设置屏幕,animation就消失了。 在从设置屏幕删除这个UILabel时,animation是可见的。 这是我连接的网点 __weak IBOutlet UIView *settingsView; __weak IBOutlet NSLayoutConstraint *settingsBottomConstraint; __weak IBOutlet NSLayoutConstraint *settingsViewHeightConstraint; 查看没有负载设置方法(setupViews) -(void)setupViews { settingsBottomConstraint.constant = – settingsViewHeightConstraint.constant; [settingsView setNeedsUpdateConstraints]; [settingsView layoutIfNeeded]; isSettingsHidden = YES; } 隐藏/取消隐藏方法 – (IBAction)showSettingsScreen:(id)sender { if (isSettingsHidden) { settingsBottomConstraint.constant = 0; [settingsView setNeedsUpdateConstraints]; [UIView animateWithDuration:.3 animations:^{ [settingsView layoutIfNeeded]; }]; } else{ settingsBottomConstraint.constant […]

如果蓝牙closuresiOS,禁用警告对话框

我的ios应用程序使用蓝牙连接到附件。 如果蓝牙没有启用,会popup一个要求我激活的popup窗口。 我注意到popup窗口出现每次我运行应用程序。 我的问题是,是否可以显示popup一次,即只有在第一次启动后( fitbit应用程序这样做,我也想知道是否有可能改变popup窗口的语言。 我的应用程序是iOS7和iOS6 如果我们不能改变语言,有没有办法来禁用这个popup,那么我将开发我自己的视图(popup)与本地化的系统? 非常感谢你!

AVSpeechSynthesizer在后台模式下

我的iOS应用程序处于后台模式时无法使iOS 7 AVSpeechSynthesizer工作。 我已经添加了“ 应用程序播放audio ”键的应用程序的支持的背景模式,但我仍然无法得到它的工作。 我也调查了用AVMutableCompositionTrack话语创build一个AVMutableCompositionTrack的可能性,然后用一个能够在后台运行的玩家以某种方式玩它,但没有运气。 在后台使用AVSpeechSynthesizer有没有人比我有更好的运气?

iOS 7:自定义后退指示图像位置

我无法正确设置自定义背光指示图片。 指标不居中! 这是一张照片: 我在didFinishLaunchingWithOptions:设置指标图像didFinishLaunchingWithOptions:方法… – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIImage *image = [UIImage imageNamed:@"Back"]; [UINavigationBar appearance].backIndicatorImage = image; [UINavigationBar appearance].backIndicatorTransitionMaskImage = image; return YES; } 我怎么能中心呢? PS我已经阅读这个自定义的背景指标图像在iOS 7中不垂直居中 ,但实际上它不适合我。

自定义Push Segue删除故事板中的导航栏和标签栏

我在定义Segue中定义了以下内容,让我们把它称为SegueX: @interface SegueX : UIStoryboardSegue @end @implementation SegueX – (void)perform { CATransition* transition = [CATransition animation]; transition.duration = 0.3; transition.type = kCATransitionFade; [[self.sourceViewController navigationController].view.layer addAnimation:transition forKey:kCATransition]; [[self.sourceViewController navigationController] pushViewController:[self destinationViewController] animated:NO]; } @end 在我的故事板中,我刚刚将一个标准的Push segue改成了SegueX。 出于某种原因,这将删除我的导航栏和标签栏。 而且,在定制的segue之后,在故事板中定义的所有UIBarButtonItems都在运行时隐藏。 我该如何解决? 我希望它不是这样的… 在更改为自定义赛格之前 改成自定义赛格后 保存到Main.storyboard <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="aUj-3O-DdX"> […]

为什么不能在drawRect中更改UIView背景颜色?

从理论上讲,您可以通过以下方式轻松设置背景色 self.backgroundColor = [UIColor redColor]; 在drawRect中,但这没有任何作用。 您可以更改视图的大小,边框,子视图等,但不能改变背景颜色。 类似的SO查询build议添加一个子视图或更改initWithFrame或initWithCoder初始化消息中的backgroundColor。 我的问题是为什么在其他特性可以改变的时候不能在drawRect中工作? 更改视图的图层backgroundColor也没有什么,也许出于同样的原因。 视图的backgroundColor和它的图层的backgroundColor之间有什么关系,因为它们不一样?

删除iOS7中的后退箭头

我想要包含一个自定义的后退button – 我可以使用上面的结果 self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back-btn"] style:UIBarButtonItemStylePlain target:nil action:nil]; 但如何删除原生蓝色button?