UINavigationController强制旋转

我的应用程序主要是肖像,但有一个视图需要横向。 我的意见是包含在一个UINavigationController,这(显然)是这个问题的原因。 所有UIViewControllers除了一个有这样的: – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } 需要横向的UIViewController有这样的: – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); } 现在,当用户到达横向UIViewController时会发生什么情况,它是以纵向显示的。 用户可以旋转他们的手机,并根据需要显示在横向(locking到横向)。 用户然后继续前进到一个肖像UIViewController,同样的情况发生:它开始在横向,然后他们旋转他们的手机,并再次成为肖像(locking肖像)。 看起来方向locking是允许的UIViewControllers之间,但自动旋转/编程方式改变方向以某种方式被阻止。 如何强制手机更新到正确的方向? 有一个临时的解决scheme:我可以检测设备的方向,并显示一条消息,要求他们旋转设备,如果不正确,但这不是最佳的。

应用程序无法访问您的照片或videoiOS 9

当我使用UIImagePicker访问我的照片库来select照片时,该应用程序有时会显示一个黑屏,有时还会显示一个屏幕,说我必须为我的应用程序授予访问照片的权限。 但是当我去设置 – >隐私 – >照片,那里没有应用程序,应用程序无处可见在设置。 我读到,我必须将两个值添加到我的Info.plist,但他们也没有工作。 有没有人运行相同的错误? 我正在使用xcode 7,swift 2.0和iOS 9 这是我提示用户进入相机的地方 @IBAction func cameraButtonPressed(sender: UIButton) { let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet) let cancelAction = UIAlertAction(title: "Cancel", style: .Default) { (UIAlertAction) -> Void in self.dismissViewControllerAnimated(true, completion: nil) } let cameraAction = UIAlertAction(title: "Take Photo", style: .Default) { (UIAlertAction) -> Void […]

操作无法完成。 (com.facebook.sdk错误2.)ios6

您好我正在使用ios6的Facebooklogin,我得到这个错误为本机popup 操作无法完成。 (com.facebook.sdk错误2) 这是使用的情景。 ( 我在simularor上运行这个 ) 我已经通过设置login到Facebook应用程序,我试图login到我的应用程序,它的工作正常。 然后,我从设置中注销了Facebook,并以不同的用户再次login。 然后我试图login到应用程序。 我得到这个错误。 我尝试使用该命令注销应用程序 [FBSession.activeSession closeAndClearTokenInformation]; 但没用。 Facebook应用程序中的包标识符与我的iOS应用程序中的相同。 这是我用来login的代码 NSArray *permissions = [[NSArray alloc] initWithObjects:@"email", nil]; [FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler: ^(FBSession *session, FBSessionState state, NSError *error) { [self sessionStateChanged:session state:state error:error]; }]; 任何帮助表示赞赏。 这是我得到的错误 (com.facebook.sdk错误2.)“UserInfo = 0x9535330 {com.facebook.sdk:ErrorLoginFailedReason = com.facebook.sdk:SystemLoginDisallowedWithoutError, com.facebook.sdk:ErrorSessionKey =,expirationDate:(null),refreshDate:(null),attemptedRefreshDate:0001-12-30 00:00:00 +0000,permissions:(null)>} 注意我在另一个事件中得到了同样的错误。 那时候,这是我的代码中的一个错误 而不是作为许可 […]

循环访问NSAttributedString属性以增加字体

我所需要的是循环遍历NSAttributedString所有属性,并增加它们的字体大小。 到目前为止,我已经到了成功循环和操作属性的地步,但是我不能保存回NSAttributedString 。 我注意到的线路不适合我。 如何保存? NSAttributedString *attrString = self.richTextEditor.attributedText; [attrString enumerateAttributesInRange: NSMakeRange(0, attrString.string.length) options:NSAttributedStringEnumerationReverse usingBlock: ^(NSDictionary *attributes, NSRange range, BOOL *stop) { NSMutableDictionary *mutableAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes]; UIFont *font = [mutableAttributes objectForKey:NSFontAttributeName]; UIFont *newFont = [UIFont fontWithName:font.fontName size:font.pointSize*2]; [mutableAttributes setObject:newFont forKey:NSFontAttributeName]; //Error: [self.richTextEditor.attributedText setAttributes:mutableAttributes range:range]; //no interfacce for setAttributes:range: }];

UIScrollView里面的UITableView在滚动后没有收到第一个水龙头

简要 我在UIScrollView里有一个UITableView的问题。 当我滚动外部滚动scrollView , table在第一次触摸时不会接收到willSelect/didSelect事件,但它在第二次触摸时会发生。 更奇怪的是,即使delegate没有,单元本身也会得到触动和突出显示的状态。 详细的解释 我的视图层次: UIView – UIScrollView (outerscroll) – Some other views and buttons – UITableView (tableView) 在滚动视图中,我有一些额外的视图dynamic扩展/closures。 表视图需要与视图的其他元素一起“固定”在顶部,所以这就是为什么我创build了这个布局,这使我能够以类似的方式轻松地移动元素,而不是像Apple推荐的那样通过使用转换滚动发生。 当outerscroll像这样移动时,表格View被转换为翻译效果: – (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (scrollView == self.outerScrollView) { CGFloat tableOffset = scrollView.contentOffset.y – self.fixedHeaderFrame.origin.y; if (tableOffset > 0) { self.tableView.contentOffset = CGPointMake(0, tableOffset); self.tableView.transform = CGAffineTransformMakeTranslation(0, tableOffset); } else { […]

将iPhone应用程序转换为Xcode 4中的通用应用程序

我正在尝试将现有的iPhone应用程序项目升级到通用应用程序,但在Xcode 4中找不到任何选项。 它在哪里?

如何使用CGAffineTransformMakeRotation?

我想绘制文本使用Quartz 2D。 “菜单”方向是错误的。 我想“菜单”仍然可读,并与X轴有45度。 以下是我的代码: CGContextSelectFont(context, "Arial", 12, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); CGContextSetRGBFillColor(context, 0, 0, 0, 1); // 6 CGContextSetRGBStrokeColor(context, 0, 0, 0, 1); CGContextSetTextMatrix(context, CGAffineTransformMake(1.0,0.0, 0.0, -1.0, 0.0, 0.0)); CGContextSetTextMatrix(context, CGAffineTransformMakeRotation(45)); CGContextShowTextAtPoint(context,10, 10, "Menu", 4);

获取系统卷iOS

我的情况很简单:我需要发出一个警告信号,并要确保用户会听到它,所以我想检查系统音量。 我怎样才能找出当前的系统容量是多less?

iOS 11 Safari在光标外引导模态文本区域

使用iOS 11 safari,input文本框光标在input文本框之外。 我们没有得到为什么它有这个问题。 正如你所看到的我的焦点文本框是电子邮件文本input,但我的光标是在它之外。 这只发生在iOS 11 Safari上

在通话状态栏(不能满足约束条件)

就像这个问题: 自动布局和通话状态栏和这个问题: 调整通话状态栏的大小? ,我有问题的通话状态栏搞砸了我的视图布局。 这是我的嵌套结构。 我有一个自定义模式ViewController嵌套在另一个ViewController。 每当“通话状态栏”显示(然后closures)时,就会发生以下情况: 这是一个在通话状态栏显示之前的样子: 发生错误后状态栏的背景蓝色是根视图控制器的背景颜色。 每当显示“通话状态栏”时,都会打印出以下错误信息: 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 […]