以编程方式同时消除UINavigation视图和Modal视图

我已经在这个网站上尝试了一些答案,但他们都没有涉及到我的问题 我有一个MasterDetail应用程序,它有两种types的segues,我正在使用。 当您按下详细视图上的button时,它会使用推入区域并将另一个详细视图推送到该视图上。 在新的detailview中(刚刚推出的那个),有一个button使用模态segue调用另一个UIView(表单)。 我想要做的是当用户select一行时,UIAlertView将显示一条消息,而同时(不必在同一时间)它将closuresUIViewcontroller(模态)并返回从推送的ViewController。 基本上,我需要能够closures所有视图控制器,一个模式和一个推(导航),使视图返回到他们开始的原始主屏幕。 我有UIAlertView工作正常,我可以通过使用[self.dismissViewControllerAnimated:YES completion:nil];来取消模态viewcontroller [self.dismissViewControllerAnimated:YES completion:nil]; 但我不知道如何解散下一个ViewController(它在导航控制器中)。 使用这个: [self.navigationController popToRootViewControllerAnimated:NO]; 不起作用。 这里是我想调用函数来删除所有视图的地方: – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlWithIDAndChallenge]; NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; UIAlertView *message = [[UIAlertView alloc] initWithTitle@"Started" message:@"The challenge has begun!" delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil]; [message show] //right here is where I […]

iOS后台应用程序networking访问

我有一个需要位置跟踪的应用程序,我认为它适合于允许的背景模型之一。 但是,当位置发生重大变化时,我需要发布到networking服务。 我已经看到在后台处理中禁止networking访问的写法,但是我没有在苹果的文档中读到。 有谁知道它是否犹太教(关于苹果政策)偶尔和非常快速的networking更新后台进程?

如何在iOS 7中超过180秒后运行NSTimer?

我已经尝试过,但在iOS 7和Xcode 4.6.2中不能工作超过180秒。 请帮帮我 UIBackgroundTaskIdentifier bgTask = UIBackgroundTaskInvalid; UIApplication *app = [UIApplication sharedApplication]; bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ [app endBackgroundTask:bgTask]; }]; NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:20 target:self selector:@selector(timerMethod) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; -(void) timerMethod{ NSLog(@"in timerMethod"); }

如何更改UITableViewRowAction标题颜色?

在“editActionsForRowAtIndexPath”方法中使用UITableViewRowAction。 我可以更改UITableViewRowAction的背景颜色,但不能更改标题颜色。 但是我想改变UITableViewRowAction的颜色。 任何有关这方面的投入都是可观的。

Protocol只能用作通用约束,因为它具有Self或associatedType的要求

您好我有一个协议的RequestType,它有associatedType模型如下。 public protocol RequestType: class { associatedtype Model var path: String { get set } } public extension RequestType { public func executeRequest(completionHandler: Result<Model, NSError> -> Void) { request.response(rootKeyPath: rootKeyPath) { [weak self] (response: Response<Model, NSError>) -> Void in completionHandler(response.result) guard let weakSelf = self else { return } if weakSelf.logging { debugPrint(response) } } […]

Firebase – 删除并重新安装应用程序不会取消对用户的身份validation

用下面的代码validation用户后(下面是我的代码的修剪版本,所以只有成功的login逻辑显示)… let firebaseReference = Firebase(url: "https://MY-FIREBASE.firebaseio.com") FBSession.openActiveSessionWithReadPermissions(["public_profile", "user_friends"], allowLoginUI: true, completionHandler: { session, state, error in if state == FBSessionState.Open { let accessToken = session.accessTokenData.accessToken firebaseReference.authWithOAuthProvider("facebook", token: accessToken, withCompletionBlock: { error, authData in if error != nil { // Login failed. } else { // Logged in! println("Logged in! \(authData)") } }) } }) } […]

将数据从WatchKit中的模式视图传回

当以模态方式呈现或推送接口控制器时,我们可以指定context参数以将一些数据传递到新控制器,如下所示。 // Push [self pushControllerWithName:@"MyController" context:[NSDictionary dictionaryWithObjectsAndKeys:someObject, @"someKey", …, nil]]; // Modal [self presentControllerWithName:@"MyController" context:[NSDictionary dictionaryWithObjectsAndKeys:someObject, @"someKey", …, nil]]; 我的问题是,我们怎么能做到相反? 假设我们为用户提供了一个模式控制器,用于从列表中select一个项目,然后返回到主控制器,我们如何获取已被选中的项目?

UICollectionView:必须使用非零布局参数进行初始化

我通过代码添加了UICollectionView 。 现在,应用程序崩溃的消息: UICollectionView must be initialized with a non-nil layout parameter 。 你有什么想法解决它? CollectionCell是UICollectionViewCell自定义类。 @property (nonatomic, strong) UICollectionView* collectionView; – (void)viewDidLoad { [super viewDidLoad]; self.collectionView = [[UICollectionView alloc]init]; [self.collectionView registerClass:[CollectionCell class] forCellWithReuseIdentifier:@"cell"]; UICollectionViewFlowLayout* flowLayout = [[UICollectionViewFlowLayout alloc]init]; flowLayout.itemSize = CGSizeMake(100, 100); [flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal]; [self.collectionView setCollectionViewLayout:flowLayout]; self.collectionView.frame = CGRectMake(0, 60, 320, 500); self.collectionView.backgroundColor = [UIColor […]

有没有办法使用path图添加文本

我有一个从MKOverlayPathViewinheritance的地图自定义视图。 我需要这个自定义视图来显示圆形,线条和文字。 我已经设法使用path绘制CGPathAddArc和CGPathAddLineToPoint函数绘制圆和线。 不过,我仍然需要添加文字。 我试图使用添加文本 [text drawAtPoint:centerPoint withFont:font]; 但我得到了无效的上下文错误。 任何想法?

UITableView与图像滚动很慢

可能重复: 带有图像的表格视图,缓慢加载和滚动 我有一个UITableView从服务器下载UITableView图像。 我观察到tableView滚动很慢。 我以为这可能会下载问题,但我已经意识到,下载完成后,表仍然滚动,图像图标大小较小。 我search了Google,但找不到任何帮助。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { btnBack.hidden = FALSE; static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.backgroundColor = [UIColor clearColor]; cell.textLabel.font = [UIFont fontWithName:@"Noteworthy" size:17.0]; cell.textLabel.font = […]