segue

How to pass button title to next view controller in Swift

…衆ロ難τιáo~ 提交于 2021-02-10 20:24:40
问题 I have several buttons defined in a loop in viewDidLoad. They are inside a content view, which is in a scroll view. for var i:Int = 0; i < colleges.count; i++ { let collegeButton = UIButton.buttonWithType(UIButtonType.System) as UIButton collegeButton.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 30) collegeButton.center = CGPoint(x: self.contentView.center.x, y: 30 * CGFloat(i) + 30) collegeButton.setTitle(sortedColleges[i], forState: UIControlState.Normal) collegeButton

Storyboard - How to segue to a SplitViewController from a Viewcontroller in navigation based application

大兔子大兔子 提交于 2021-02-08 09:51:22
问题 I have a navigation controller based iPad application. I am using storyboards for the app design. From one of the ViewControllers in the Navigation stack, I need to segue to a screen showing splitviewcontroller. how to I go about that ? Thanks in advance for any help on this. 回答1: A UISplitViewController must always be the first/main view controller you use. You can't use it from a UINavigationController or a UITabBarController or similar. 回答2: I had the exact same problem and I solved it by

Black screen page on apple watch apps with more that one page

孤者浪人 提交于 2021-01-29 09:51:07
问题 Hi I have created a Watch app which has two pages but when I run it on apple watch and do switch between pages after few seconds one page(sometimes page1 and sometimes page2)goes black and It doesn’t show my buttons, labels nothing. But when I run it on simulator there is no problem everything is fine and also before i add second page to the app It was ok on apple watch too 回答1: I had the same issue and it was due to calling crownSequencer.focus() without a corresponding crownSequencer

什么是Unwind segues,您如何使用它们?

。_饼干妹妹 提交于 2020-08-14 16:38:26
问题: iOS 6 and Xcode 4.5 has a new feature referred to as "Unwind Segue": iOS 6和Xcode 4.5具有称为“ Unwind Segue”的新功能: Unwind segues can allow transitioning to existing instances of scenes in a storyboard 放开序列可以允许过渡到情节提要中场景的现有实例 In addition to this brief entry in Xcode 4.5's release notes, UIViewController now seem to have a couple of new methods: 除了Xcode 4.5发行说明中的​​这一简短条目之外,UIViewController现在似乎还有一些新方法: - (BOOL)canPerformUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender - (UIViewController *)viewControllerForUnwindSegueAction:(SEL)action

Functional difference, UINavigationController vs Only Storyboard Segue

一笑奈何 提交于 2020-06-24 14:02:54
问题 So UIKit Framework Reference describes UINavigationController as an efficient way to present data and views to user. But I'm curious as to the performance and manageability differences between using UINavigationController VS Segue Only. There must be certain situations that one is better-suited than the other. I am entirely new to coding but instinctually I imagine UINavigationController is more for presenting VC's that each have a lot going on and user spends much time on each VC equally or

Display and dismiss a modal view controller in Swift

陌路散爱 提交于 2020-06-24 07:12:07
问题 When a button is pressed I want to segue between two view controllers by using a Modal Transition style CoverVertical and then dismiss it. There is allot of info out there for how to do it in objective C but can't find any good info in Swift. So far I've done this but I don't think it's correct: @IBAction func insertStatus(sender: UIButton) { var StatusVC: StatusViewController = StatusViewController() var modalStyle: UIModalTransitionStyle = UIModalTransitionStyle.CoverVertical StatusVC

Display and dismiss a modal view controller in Swift

不问归期 提交于 2020-06-24 07:11:10
问题 When a button is pressed I want to segue between two view controllers by using a Modal Transition style CoverVertical and then dismiss it. There is allot of info out there for how to do it in objective C but can't find any good info in Swift. So far I've done this but I don't think it's correct: @IBAction func insertStatus(sender: UIButton) { var StatusVC: StatusViewController = StatusViewController() var modalStyle: UIModalTransitionStyle = UIModalTransitionStyle.CoverVertical StatusVC

使用segue时如何实现login的判断

孤街醉人 提交于 2020-03-02 18:51:45
segue是storyboard中进行场景转换的核心。 实际操作的时候,和以前的代码思维方式有不同之处。比如说,login的实现。 (一) 代码思维代码: - (void)configureLoginButton { UIButton *loginButton = [UIButton ButtonWithType:UIButtonTypeCustom]; // 省略button的设置代码。 [loginButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; } - (void) buttonClicked:(id)sender { UIViewController *VC = [[UIViewController alloc] init]; [self presentViewController:VC animated:YES completion:nil]; } (二)这种代码思维如果被带到storyboard中,可能会这样操作: 在场景中设置一个 loginButton 。 选中 loginButton,Ctrl+拖拽到相应文件的代码中,生成一个IBAction方法。 在这个IBAction方法中执行上面的

如何传递prepareForSegue:一个对象

旧巷老猫 提交于 2020-02-28 06:02:22
我在地图 rightCalloutAccessory 有很多注释(带有 rightCalloutAccessory 按钮)。 该按钮将从此 mapview 到 tableview 。 我想根据单击哪个标注按钮将不同的对象(包含数据)传递给 tableview 。 例如:(全部组成) 注解1(Austin)->传递数据obj 1(与Austin相关) 注解2(达拉斯)->传递数据obj 2(与达拉斯相关) 注解3(休斯敦)->传递数据obj 3,依此类推...(你明白了) 我能够检测到单击了哪个标注按钮。 我正在使用 prepareForSegue :将数据obj传递到目标 ViewController 。 由于无法进行此调用,因此无法为我需要的数据obj加上额外的参数,因此有什么优雅的方法可以实现相同的效果(动态数据obj)? 任何提示将不胜感激。 #1楼 有时,避免在两个视图控制器之间创建编译时依赖性很有帮助。 在不关心目标视图控制器类型的情况下,可以按照以下方法进行操作: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.destinationViewController respondsToSelector:@selector(setMyData:)]) {

Xcode - Segue issues

三世轮回 提交于 2020-02-16 06:38:23
问题 i've been trying to get a segue to work. I've written the following... but for some reason, the ...preparesegue... method doesnt fire. I've read other related posts but i cant get it to fire, and just as importantly, the variable i'm need isnt transferred. m file: @implementation CountryTableViewController -(void) getData:(NSData *) data { NSError *error; json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; [self.tableView reloadData]; } -(void) start { NSURL