Tag: ios7

在IOS 7中的UINavigationBar下的白线

我有一个UITableViewController与UISearchDisplayController和UISearchBar 。 当我在UITabBarController呈现视图时,我在导航栏下看到一条白线。 当我在UINavigationController中以模态方式呈现视图时,该线条是灰色或黑色(我无法说出),看起来完全正常。 有任何想法吗?

在iOS7和更高版本的接收器和扬声器之间切换audio输出?

我有一个audio播放器,当接近传感器通知1时,可以select将audio输出从扬声器切换到接收器/听筒(不pipe耳机是否连接)。以下是我的代码。 – (void) switchAudioOutput:(NSString*)output{ AVAudioSession* audioSession = [AVAudioSession sharedInstance]; BOOL success; NSError* error; if([output isEqualToString:keAudioOutputReciever]){ //Force current audio out through reciever //set the audioSession override success = [audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:&error]; if (!success) NSLog(@"AVAudioSession error overrideOutputAudioPort:%@",error); //activate the audio session success = [audioSession setActive:YES error:&error]; if (!success) NSLog(@"AVAudioSession error activating: %@",error); else NSLog(@"AVAudioSession active with override: […]

嵌套推animationiOS7的错误?

我刚刚遇到了一个错误testing的应用程序的问题。 我正猛地把头靠在墙上,明白为什么我得到这个错误: 2013-11-25 09:02:55.687[186:60b] nested push animation can result in corrupted navigation bar 2013-11-25 09:02:56.055[186:60b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. 2013-11-25 09:02:57.666[186:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't add self as subview' 一段时间后,我创build了一个新的项目,试图重现该错误: 这发生在我按下两个不同时间的酒吧button项目,然后同时释放。 我正在使用与segues故事板,没有任何自己写的代码。 这是一个iOS7的错误,或者我错过了什么? 我没有能够在模拟器上重现,因为我没有两个游标…我使用的iOS2 7.0.3的iPad2 故事板的图像: 编辑: […]

地图旋转在ios8上非常慢

我在一个旧项目的VC(无故事板,纯代码)中获得了以下代码: – (void)viewDidLoad { [super viewDidLoad]; self.mapView = [[MKMapView alloc] initWithFrame:CGRectInset(self.view.frame, 10, 10) ]; [self.view addSubview:self.mapView]; self.view.backgroundColor = [UIColor redColor]; self.mapView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; self.view.translatesAutoresizingMaskIntoConstraints = NO; // <— this line } 如果我评论最后一行,从纵向到横向或者其他方式的旋转是在ios8下大约3秒钟 ! 此外,偶尔在随机时间无法分配渲染缓冲区存储! 出现错误。 如果我不评论,几乎是瞬间的( 0.7秒 )。 看来只是和mapviews有关,其他视图/ VC才能正常旋转。 在ios7下,在任何情况下,旋转都是快速的。 为什么? 为什么只有mapview受到影响? 编辑:显然,autoresizingmask是错误的。 如果在viewDidLoad我将其值设置为none,并手动更改在willRotate中的框架,它工作得很快。

重新创buildiOS 7日历UIViewanimation

每个人都知道iOS 7日历应用程序中全新的animation。 你可以在这个简短的video中看到他们: http : //vimeo.com/69247779 我会重新创build一个类似的东西,创build一个“模态”矩形,当用户点击一个UIButton 。 当用户点击这个button时,应用程序应该移动一个UIView (实际上在一个UITableViewCell ),并在这个矩形内移动它,但是原来的UIView应该保持在同一个地方。 它需要重复自己,类似的东西。 我创build了一个简单的图像来解释这个概念。 如何实现这样的事情?

我如何解密签名并添加到目标c中的YouTube提取的URL?

我正在尝试在我的应用程序中播放YouTubevideo。 一切正常。 但是当我试图观看包含来自YouTube的内容的video。 它失败。 我研究发现一个人认为你应该encryption和解密签名,并将其添加到URL? 我不知道如何decrypt signature在IOS decrypt signature ? http://www.youtube.com/get_video_info?video_id=uuZE_IRwLNI&el=vevo&ps=default&eurl=&gl=US&hl=en stream { "fallback_host" = "tc.v12.cache7.googlevideo.com"; itag = 22; quality = hd720; s = "8E6E5D13EB65FB653B173B94CB0BCC3A20853F5EDE8.5E2E87DF33EEDE165FEA90109D3C7D5DADA06B6BB60"; type = "video/mp4; codecs=\"avc1.64001F, mp4a.40.2\""; url = "http://r7—sn-cvh7zn7r.googlevideo.com/videoplayback?pcm2fr=yes&sver=3&expire=1393773646&itag=22&id=bae644fc84702cd2&upn=SjZd81MudQs&sparams=gcr%2Cid%2Cip%2Cipbits%2Citag%2Cpcm2fr%2Cratebypass%2Csource%2Cupn%2Cexpire&ms=au&gcr=in&mt=1393747698&source=youtube&ratebypass=yes&ipbits=0&fexp=935620%2C919120%2C912523%2C932288%2C914084%2C916626%2C937417%2C937416%2C913434%2C932289%2C936910%2C936913%2C902907&mv=m&key=yt5&ip=103.250.162.79"; } 当我使用的url不播放。 有没有解决办法?

如何获得自定义的UIPickerView

嘿,伙计们请帮助我,我想在自定义UIPiker中实现以下function如下图所示。 我只想像上面那样改变选定区域的文字颜色

NSAttributedString为UITextView sizeThatFits和boundingRectWithSize报告不正确的大小,并设置了正确的选项

我有一个NSAttributedString报告一个boundingRectWithSize(和扩展UITextView不正确地计算其sizeThatFits)当字体大小从用于创build它的字体大小减less。 它不会发生在我做类似的操作的所有NSAttributedStrings,所以这里是重现的步骤。 使用不包含完整Unicode字符集的非标准字体。 确保string包含此“不受支持”集中的字符。 iOS会将它们渲染为Helvetica,大小适中。 在您的NSAttributedString中缩放字体的所有字体属性。 我的代码这样做产生的问题看起来像这样。 从UITextView子类中: NSMutableAttributedString *mutableString = [self.attributedText mutableCopy]; [mutableString enumerateAttribute:NSFontAttributeName inRange:NSMakeRange(0, mutableString.length) options:0 usingBlock:^(id value, NSRange range, BOOL *stop) { if (value) { UIFont *oldFont = (UIFont *)value; UIFont *newFont = [oldFont fontWithSize:oldFont.pointSize – 1]; [mutableString removeAttribute:NSFontAttributeName range:range]; [mutableString addAttribute:NSFontAttributeName value:newFont range:range]; } }]; self.attributedText = [mutableString copy]; 我注意到,当在while循环中运行这个代码时,检查sizeThatFits来知道文本何时足够小,以至于在某些情况下我会产生一个零竞赛。 对于任何小于我开始使用的字体值的情况,高度计算为60px,这恰好是50px。 […]

在UICollectionView布局中自定义头的位置会导致NSInternalInconsistencyException错误

我试图自定义UICollectionView使用子类UICollectionViewFlowLayout类(基于宽松的代码堆叠标题显示input链接描述在这里 )的标头的位置。 作为一个最小的testing,让我们说我只是想添加一个固定的偏移量到所有标题的位置: 我将所有的头添加到由layoutAttributesForElementsInRect返回的数组中,以便所有的头都被处理(这可能是问题的原因,我不确定) 然后,我通过在layoutAttributesForSupplementaryViewOfKind添加一个固定的偏移来更新每个头 完整的实现包括在这篇文章的末尾。 (顺便说一句,我知道添加所有标题,包括rect之外的所有标题,在第一步中并不是严格意义上的必要,但这是一个简单的例子,我想创build一个更复杂的定制,这将导致所有标题将被显示在绘制rect)。 但是,当我运行代码时,我得到以下NSInternalInconsistencyException : 2014-01-15 00:41:50.130 CollectionStackedHeaders[60777:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'layout attributes for supplementary item at index path (<NSIndexPath: 0x8a7db90> {length = 2, path = 0 – 0}) changed from <UICollectionViewLayoutAttributes: 0x8a7f8b0> index path: (<NSIndexPath: 0x8a7d9c0> {length = 2, path = 0 – 0}); […]

iOS 7蓝牙输出不适用于AVAudioSessionCategoryPlayAndRecord

在我的应用程序中,如果iPhone连接到蓝牙耳机,则使用蓝牙播放声音。 否则使用默认扬声器。 这是我的代码 [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil]; [[AVAudioSession sharedInstance] setMode:AVAudioSessionModeVoiceChat error:nil]; [[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:nil]; [[AVAudioSession sharedInstance] setActive:YES error:nil]; 但是,当我试图使用类别setCategory:AVAudioSessionCategoryPlayAndRecord。 路由到蓝牙设备停止工作..我不知道为什么。 因为正确的,蓝牙选项应该只适用于logging或PlayAndRecord类别… / *只适用于AVAudioSessionCategoryRecord和AVAudioSessionCategoryPlayAndRecord * / 另外:我可以只有蓝牙输出(input仍然使用默认话筒从电话)? UPDATE 我通过先调用setMode来改变顺序,然后是setCategory。 它首次运行应用程序(一个调用)。 当我试图再次做同样的动作,currentRoute仍然给我输出=蓝牙,但实际输出返回到默认的电话前置扬声器。