当我在Xcode 5中创建我的iOS项目时,我单击了选项以向项目添加测试.是否有可能删除所有测试内容,就像我没有点击选项开始一样?
我刚刚在Xcode 5中将CocoaPods添加到我当前的项目中.当然,CocoaPods创建了一个工作区,我在Xcode中启动了工作区.我在工作区中看到了我的项目和Pods项目.
从第一天开始,我的项目一直处于源代码管理(本地git +远程Bitbucket存储库)之下.现在我想提交并添加Pod的东西,但我认为我的repo在工作空间中太深了 - 当我尝试提交时(我已经尝试了各种提交来获取Pod的东西)它总是出错.
如何将我的Pod添加到我的仓库?我是否必须删除旧的repo并在Workspace级别创建一个新的(git init)?(我当然希望不是因为我对git不是那么好,而且我已经在我的回购中做了很多历史性的提交.)
在我的iPad应用程序中,我有一个应用程序设置视图 其中一个选项允许用户切换界面颜色方案.设置视图由segue加载到一个单独的视图控制器,而不是我的"主"应用程序窗口.
当他们选择一种新颜色时,我切换colorSchemeColor变量并执行以下操作:
// set the colors and refresh the view
[[UINavigationBar appearance] setBarTintColor:colorSchemeColor];
[[UIToolbar appearance] setBarTintColor:colorSchemeColor];
[[UITabBar appearance] setBarTintColor:colorSchemeColor];
Run Code Online (Sandbox Code Playgroud)
但是,在退出设置视图之前,没有任何条形图会改变颜色!(当设置窗口消失时,"主"应用程序的颜色会正确更改!)
那么我尝试在刷新设置视图后立即放置此代码:
[self.view setNeedsDisplay];
[self.view setNeedsLayout];
Run Code Online (Sandbox Code Playgroud)
这没有帮助.所以我也添加了这个:
[self.navigationController.view setNeedsDisplay];
[self.navigationController.view setNeedsLayout];
Run Code Online (Sandbox Code Playgroud)
这也不起作用.
当选择新颜色时,如何将我的设置视图设置为"重绘",以便更改立即变得明显?
非常感谢!
我有一个iOS应用程序,我需要知道什么时候新的视图在屏幕上完全可见; 也就是说,当Autolayout完成计算并且视图已完成绘制时.
在视图完全可见之前,ViewDidAppear似乎很好.如果我关闭Autolayout,时间似乎与人类感知一致,但我需要在这个项目中使用Autolayout(所以这不是一个解决方案......只是一个测试).
当Autolayout完成计算时,是否有任何方法可以触发?或者视图实际可见时触发的另一种方法(因为ViewDidAppear不适用于此)?
谢谢!
在Swift 2.0中,Core Data中的一对多关系仍然是NSOrderedSets吗?
我似乎无法适当地投射/投降以至于不会抛出错误.
有人在Swift 2.0中有一个简单的例子吗?
像其他人来到iOS8,我收到警告:
Presenting view controllers on detached view controllers is discouraged <EditItineraryViewController: 0x7ca56e00>.
Run Code Online (Sandbox Code Playgroud)
这是由以下代码引起的:
- (void)editActivityDetailsForIndexPath:(NSIndexPath *)indexPath {
NSPredicate *predicateForDisplay = [[NSPredicate alloc] init];
switch (indexPath.section) {
case kIncompleteActivitiesSection:
predicateForDisplay = _predIncomplete;
break;
case kCompleteActivitiesSection:
predicateForDisplay = _predComplete;
break;
default:
break;
}
NSString *theActivityName = [[NSString alloc] init];
theActivityName = [[[_activitiesArray filteredArrayUsingPredicate:predicateForDisplay] objectAtIndex:indexPath.row] activityName];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ActivityDetailViewController *activityDetailVC = [storyboard instantiateViewControllerWithIdentifier:@"ActivityDetailView"];
activityDetailVC.modalPresentationStyle = UIModalPresentationFormSheet;
activityDetailVC.delegate = self;
// send the activity to the view
activityDetailVC.theActivity = [[_activitiesArray …Run Code Online (Sandbox Code Playgroud) 我有一个UITableView,我使用以下NSfetchedResultsController从Core Data填充:
- (NSFetchedResultsController *)fetchedResultsController {
if (_fetchedResultsController != nil) {
return _fetchedResultsController;
}
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:_managedObjectContext];
[fetchRequest setEntity:entity];
NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:YES];
[fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]];
[fetchRequest setFetchBatchSize:20];
NSFetchedResultsController *theFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:_managedObjectContext sectionNameKeyPath:nil cacheName:@"Root"];
self.fetchedResultsController = theFetchedResultsController;
_fetchedResultsController.delegate = self;
return _fetchedResultsController;
}
Run Code Online (Sandbox Code Playgroud)
我有另一个方法附加到"添加"按钮,该按钮将新的核心数据项添加到数据库.添加对象后,我的表会正确更新,并且根据获取的结果控制器中的"日期"排序,新对象将显示在正确的位置.我的新对象使用今天的日期添加其"日期"属性.我添加这样的对象:
NSManagedObject *newEvent = [NSEntityDescription insertNewObjectForEntityForName:@"Event" inManagedObjectContext:context];
[newEvent setValue:@"New Client" forKey:@"name"];
[newEvent setValue:[NSDate date] forKey:@"date"];
NSError *error;
if (![context save:&error]) {
NSLog(@"Core …Run Code Online (Sandbox Code Playgroud) core-data uitableview nsindexpath nsfetchedresultscontroller ios
ios ×5
core-data ×2
uitableview ×2
xcode ×2
appearance ×1
autolayout ×1
cocoapods ×1
git ×1
git-commit ×1
ios8 ×1
nsindexpath ×1
nsorderedset ×1
objective-c ×1
swift ×1
uipopover ×1
uitabbar ×1
uitoolbar ×1
unit-testing ×1
viewdidload ×1