Tag: ios8

如何正确地将NSMutableArray传递给具有自定义数据模型的NSUserDefaults?

让我先说一下,我的代码有目的被遮蔽了一点。 我知道这个名字不好。 我正在尝试使用新的iOS 8function将小部件添加到我的应用程序中。 我正在使用这个链接作为教程 现在,到目前为止,当我的提交button在我的应用程序中被调用时,我在我的ViewController中。 到目前为止,我已经将该数组中的所有数据传递给了该数组。 //Passes the array of times to the shared group to be called by the notification center widget. NSUserDefaults *sharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.myGroup.TodayExtensionSharingDefaults"]; NSData *encodedArray = [NSKeyedArchiver archivedDataWithRootObject:tableViewController.TimeArray]; [sharedDefaults setObject:encodedArray forKey:@"TimesArray"]; [sharedDefaults synchronize]; 但是,我的数组存储了我创build的自定义数据模型,所以在我的数据模型中有: – (void)encodeWithCoder:(NSCoder *)encoder { //Encode properties, other class variables, etc [encoder encodeInt:_stopNumber forKey:@"stopNumber"]; [encoder […]

以横向模式发布在Widget中

我有这个令人讨厌的小部件问题,它在横向模式下修剪我的视图的内容。 我已经把内容大小静态,但它不工作。 苹果是否限制小部件在景观中具有特定的高度? 苹果的界面指导方针表示不推荐,但是可行吗? 编辑:

iOS 7 iPad方向问题,当在UITextField上出现键盘后,视图向上移动时

在我的应用程序中,我不想移动/使我的ViewController的视图在UITextField上出现键盘之后向上移动。 这必须支持所有的方向.ie: UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight。 对于UIInterfaceOrientationPortrait我的代码工作正常,如下所示: 但是对于UIInterfaceOrientationPortraitUpsideDown和UIInterfaceOrientationLandscapeLeft,它不起作用 。 请看下面的截图: UIInterfaceOrientationLandscapeLeft视图移向右侧而不是向上移动 。 对于UIInterfaceOrientationPortraitUpsideDown视图向下移动而不是向上移动 。 这只是iOS 7中的问题。我已经在iOS 8中检查过了,它工作正常。 我用下面的代码在键盘外观上animationUIView: static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3; static const CGFloat MINIMUM_SCROLL_FRACTION = 0.2; static const CGFloat MAXIMUM_SCROLL_FRACTION = 0.8; static const CGFloat PORTRAIT_KEYBOARD_HEIGHT = 264; static const CGFloat LANDSCAPE_KEYBOARD_HEIGHT = 352; -(void) textFieldDidBeginEditing:(UITextField *)textField { CGRect textFieldRect = […]

UIAlertView键盘覆盖textview问题

我发现这个代码: CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0); [myAlertView setTransform:myTransform]; 但似乎要把我的戒备提高到顶端。 如何将警报视图移到顶端? 设置框架也没有帮助。 alerView.frame = rect;

找不到支持键盘types的键盘

我有用于input电子邮件的UITextField。 所有的工作 – 但我在debugging器terminal有这个问题: Can't find keyplane that supports type 7 for keyboard iPhone-Portrait-Emoji-Email; using 1582125428_Portrait_iPhone-Emoji-Keyboard_Letters 我怎样才能解决它?

audio不在cordovaiOS 8中播放

我无法在iOS 8 Cordova应用程序中播放audio。 相同的代码适用于iOS 7。 我得到的消息是, 未知资源'文件:// audioFilePath' 我的cordova版本是3.5.1和媒体插件版本是0.2.15 任何帮助表示赞赏。 谢谢。

容器视图接收触摸,而不是iPad上的子视图

我有一个UITableViewController在UIView里面触及iOS8(在iOS7中工作正常)的问题。 这是设置代码: UITableViewController *tvc = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped]; tvc.tableView.userInteractionEnabled = YES; tvc.tableView.frame = CGRectMake(0, 0, self.incentivesContainerView.frame.size.width, self.incentivesContainerView.frame.size.height); [self addChildViewController:tvc]; self.incentivesContainerView.clipsToBounds = YES; [self.incentivesContainerView addSubview:tvc.view]; 我有数据源和委托设置,一切工作正常与数据。 问题是这个incentiveContainerView似乎阻碍了对UITableViewController的触动。 我有一个问题的解决方法,添加一个手势识别器的容器: [self.incentivesContainerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tappedSelectIncentivesView:)]]; 哪些电话: – (void)tappedSelectIncentivesView:(UITapGestureRecognizer *)tap { CGPoint tapSpot = [tap locationInView:self.selectIncentivesVC.tableView]; [self.selectIncentivesVC tableView:self.selectIncentivesVC.tableView didSelectRowAtIndexPath:[self.selectIncentivesVC.tableView indexPathForRowAtPoint:tapSpot]]; } 传递触摸事件,并正常工作。 不过,如果可能的话,我想要一个更清洁的方法,有没有更好的方法来做到这一点? 我发现这个post,看起来像我的问题,但我真的不愿意子类UIView: 如何使触摸事件影响视图的容器视图后面? 我在SO上发现了一些其他类似的post,但是对我来说并不是很有用,有什么build议吗? 谢谢!

UITableView细节过渡

我正在尝试做一个详细的清单,但我不能做到这一点,我不明白为什么。 是故事板,故事板连接好。 只有一个tableView和View控制器的细节。 我试图推入一个单元格,并进入详细信息屏幕和细节类我有两个propertys,但是当我推入一个单元格,应用程序崩溃,我有一个例外: 终止应用程序,由于未捕获的exception“NSInternalInconsistencyException”,原因:'无法加载捆绑NIB:'名为'GasolDetalleVCViewController''NSBundle(加载)'***第一个抛出调用堆栈: 这些课程是: 表格控制器.h: #import <UIKit/UIKit.h> #import "GasolDetalleVCViewController.h" #import "DetallesGasol.h" @interface GasolTVCTableViewController : UITableViewController <UITableViewDataSource, UITableViewDelegate> { NSMutableArray *arrayNombrePrecio; NSInteger celdaPulsada; } @end 表格控制器.m: #import "GasolTVCTableViewController.h" @interface GasolTVCTableViewController () @end @implementation GasolTVCTableViewController – (void)viewDidLoad { [super viewDidLoad]; arrayNombrePrecio = [NSMutableArray arrayWithCapacity:10]; DetallesGasol *textoCelda0 = [[DetallesGasol alloc]init]; DetallesGasol *textoCelda1 = [[DetallesGasol alloc]init]; DetallesGasol […]

UISplitViewController与新的UISearchController问题与UISearchBar

我最近开始重写我的iOS应用程序,使用新的UISearchController和一个通用的故事板。 我的应用程序适用于这两种设备( iPhone和iPad ),所以使用UISplitViewController更改为通用故事板是一大优势。 但不幸的是, UISearchController没有按预期工作。 我用下面几行添加了UISearchController : self.searchController = UISearchController(searchResultsController: nil) self.searchController.searchBar.sizeToFit() self.searchController.dimsBackgroundDuringPresentation = false self.myTableView.tableHeaderView = self.searchController.searchBar self.searchController.searchResultsUpdater = self self.definesPresentationContext = true 我的控制器链是这样的: UISplitViewController UITabbarController (Master) UINavigationController UITableViewController UINavigationController (Detail) UINavigationController UIViewController 问题是在UISearchBar覆盖的iPad应用程序。 但是,如果我切换选项卡,并返回到视图。 UISearchBar是可见的。 所以不知何故,在一个tabbar开关后,它正确地重绘视图。 在iPhone版本中,它会自动更正。 iPad应用程序 第一次启动后, UISearchBar被UINavigationBar覆盖 切换标签后, UISearchBar显示正确 iPhone应用程序 iPhone应用程序正常工作,无需更改标签。 我试过的: 使用extendsEdges的不同设置 在viewWillAppear方法中添加SearchController,因为我以后可以通过添加search控件来欺骗它

这个背景应用程序通知的名称是什么?

如果我在iOS 8上启动语音备忘录,并转至其他应用程序(例如便笺),屏幕上方将出现红色通知(请参阅下面的“录制00:16”)。 这个通知的名字是什么? 相关的iOS文档在哪里?