jjzjj

SecondViewController

全部标签

iphone - 从 App Delegate 调用时 PushViewController 不起作用

我有一个基于标签栏的应用程序。当应用程序激活时,我希望它转到第二个选项卡栏(SecondViewController),然后打开DetailViewController。这是我的做法:AppDelegate.m-(void)applicationDidBecomeActive:(UIApplication*)application{self.tabBarController.selectedViewController=[self.tabBarController.viewControllersobjectAtIndex:1];SecondViewController*secondVi

iOS 如何将 pushviewcontroller 与 NavigationController(Objective - c) 一起使用

我想通过单击带有NavigationController的按钮来更改View所以我在Main.storyboard中添加了一个按钮并编写了一些代码,例如@property(weak,nonatomic)IBOutletUIButton*button;在我的ViewController.m中(在我创建项目时自动创建)然后我添加了方法-(IBAction)buttonClicked:(id)sender{SecondViewController*secondViewController=[[SecondViewControlleralloc]initWithNibName:@"Second

ios - 使用 Objective-C 在类之间传递数据

我需要一些关于如何在类之间传递数据的信息。具体来说,我想将一些信息存储在一个类的数组中(使用模型存储类),然后在另一个类中使用它。 最佳答案 你可以这样做:例如:您想将Array从FirstViewController传递给SecondViewController。首先在SecondViewController中创建Array并将其定义为SecondViewController.h中的属性:NSMutableArray*secondArr;@property(nonatomic,retain)NSMutableArray*secon

ios - iPhone - 从另一个 View Controller 调用函数

我有一个名为sendDataToMotor的函数。它在我的第一个ViewController类中。我有另一个名为SecondViewController的ViewController。我需要从SecondViewController.m类调用此函数。我尝试声明属性:@property(nonatomic,assign)UIViewController*firstController;在我的SecondViewController.h类中。此外,我在我的SecondViewController.m类的viewDidLoad部分中编写了下面的代码(我希望在其中调用该函数)。secondVi

iphone - 2个 Storyboard之间的过渡

我的应用程序中有2个Storyboard文件,我想在一个的ViewController和另一个的ViewController之间转换。我连接了一个IBAction以响应第一个ViewController上的按钮按下,它调用AppDelegate中的一个方法。我已验证此信号到达AppDelegate方法。这是我在AppDelegate中的相关方法,但是没有发生转换。谁能告诉我为什么,或者拥有2个Storyboard是不是一个愚蠢的想法?-(void)presentSecondViewController{UIStoryboard*mainStoryboard=[UIStoryboards

ios - 如何以编程方式导航到另一个 View Controller ,在 ios 9 中使用 "over current context "表示, Objective-C

我正在使用Storyboard构建我的应用程序。因此我可以在按下按钮时通过拖动打开另一个ViewController。然后我可以选择presentation=overcurrentcontext对于Storyboard中的segue。但我想要以编程方式执行此操作。我找到了一个答案,但它说它只适用于ipad。我正在构建一个通用应用程序,所以我想在所有设备上使用它。这可能吗。我该怎么做。在我的第一个ViewController中UIStoryboard*story=[UIStoryboardstoryboardWithName:@"Main"bundle:[NSBundlemainBund

iphone - 标签栏点击委托(delegate)

我有两个ViewController(FirstViewController和SecondViewController)和一个选项卡栏Controller,并且我正在使用Storyboard。在FirstViewController中,用户可以拖放ImageView。因此,每次用户单击显示SecondViewController的第二个TabBarItem时,我想检查用户是否在每次单击TabBarItem时都放下了图像。所以我知道这可以通过UITabBarDelegate及其方法-(void)tabBar:(UITabBar*)tabBardidSelectItem:(UITabBar

ios - 从 Storyboard 获取 ViewController

我有两个ViewController,它们没有(直接)与Segue连接。但是我想在第二个VC中更改一个字符串,这是我在第一个VC中得到的。我的尝试是:#import"secondViewController.h"@interfacefirstViewController()@propertyNSString*originalString;@end@implementationfirstViewController-(void)viewDidDisappear:(BOOL)animated{[superviewDidDisappear:animated];secondViewContro

ios - 使用 block 将数据传回 View Controller

我在看thisquestion.其中一个答案显示了如何使用block向后传递数据查看prepareForSegue方法。我的理解是这种方法应该真正用于向前传递数据,而不是向后传递数据。我想为此目的尝试block-将数据传递回另一个viewController。我的问题是:如何在不使用prepareForSegue方法的情况下执行此操作?例如,我可以在UITableView中使用-didselectRowAtIndexPath并关闭View-但是接收View如何得到“通知”有数据返回,而不使用委托(delegate)? 最佳答案 向后

ios - 从另一个 UIViewController 调用方法没有可见效果

我有两个类,想在按下按钮时调用一个类的方法。我在我的.h文件中这样声明它:-(void)imageChange;然后我在我的.m中创建了这样的方法:-(void)imageChange{UIImage*image=[UIImageimageNamed:img];[_MyImagesetImage:image];}最后,我尝试使用以下方法调用另一个类的方法:-(IBAction)Done:(id)sender{SecondViewController*theInstance=[[SecondViewControlleralloc]init];[theInstanceimageChange