uiviewcontroller

push a view controller from a UIView ios

巧了我就是萌 提交于 2019-12-24 11:37:03
问题 I have a navigation based application.On click of a button on the navigation bar in the first screen , I am able to push another view controller as follows : -(void) buttonClicked:(id)sender { UIViewController* mv = [[SecondViewController alloc] init]; [[self navigationController] pushViewController:mv animated:YES]; } Now i have a UIView(separate .h and .m files) as part of the first screen. On click of a button in the UIView, i want to push the SecondViewController. I have tried the

Adding an entirely different view behind the current view

江枫思渺然 提交于 2019-12-24 11:35:23
问题 Summary: I am trying to implement a pan gesture that works just like Apple's default pan back gesture (interactivePopGestureRecognizer). The only difference is that it snaps all the way back to the primary view of a splitview controller rather than just going back one view on the stack. This is accomplished with popToRootViewController. What I can currently do: My subclass of the UIScreenEdgePanGestureRecognizer is able to follow the user's touch and animate to the proper location based on

Switching storyboard view controller in Objective-C

瘦欲@ 提交于 2019-12-24 11:19:32
问题 I am trying to switch to different ViewController on same storyboard like so: CalendarViewController *CalViewController = [[CalendarViewController alloc] init]; [self presentViewController:CalViewController animated:NO completion:nil]; When I run this action, corresponding implementation file executes NSLog message but screen goes black with no errors being displayed. How do I fix this? 回答1: Let's suppose you created your CalendarViewController interface in a storyboard, and you assigned it

Send a Delegate message from UIPopover to Main UIViewController

廉价感情. 提交于 2019-12-24 11:15:09
问题 I'm trying to use a Button in my UIPopover to create a UITextView in my Main UIViewController the code I have looks something like this ( PopoverView.h file): @protocol PopoverDelegate <NSObject> - (void)buttonAPressed; @end @interface PopoverView : UIViewController <UITextViewDelegate> { //<UITextViewDelegate> id <PopoverDelegate> delegate; BOOL sendDelegateMessages; } @property (nonatomic, retain) id delegate; @property (nonatomic) BOOL sendDelegateMessages; @end Then in my PopoverView.m

how can we use UICollectionView without an UICollectionViewController

被刻印的时光 ゝ 提交于 2019-12-24 11:09:25
问题 Normaly, if we want to use UICollectionView , we must use an UICollectionViewController . But now I don't want, so how can I use UICollectionView without an UICollectionViewController ? 回答1: Of course you can use a UICollectionView without an UICollectionViewController . Just create a UICollectionViewLayout of your choice, and then call - (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout to create a new instance of UICollectionView . Don't forget to set the

uidatepicker in uipopover delegate

无人久伴 提交于 2019-12-24 10:46:14
问题 I am trying to insert a uipopover with uidatepicker in it with two buttons - Cancel and Done. I was able to design the layout using storyboard with the help of UIDatePicker in UIPopover and How can I show a UIDatePicker inside a Popover on iPad using StoryBoard? But, I am not able to get the date from uidatepicker to uiviewcontroller when Done button is pressed. I am new to ios programming and i find delegate methods very confusing. Could somebody shed some light? Help much appreciated. Thank

want to call ViewController's method from appdelegate

谁说胖子不能爱 提交于 2019-12-24 10:40:01
问题 I want to call ViewController 's method in AppDelegate.m. i have method method() in my Viewcontroller .i want it to be called when didSelectMethod() called in appdelegate.m . I have called method like this.- ViewController *vc=[[ViewController alloc]init]; [vc method]; method is called but not having same instance as actually method having. it having all nill values. can anyone give me right code for this what i want. Thank you Jagveer Rana 回答1: While this has been correctly answered for the

iOS 5 Wait for delegate to finish before populating a table?

别说谁变了你拦得住时间么 提交于 2019-12-24 10:16:32
问题 I am working on an iOS 5 app. I have a view controller that needs to display data as soon as its opened. The desired order of functionality is: Call a web service Wait for the reply from the web service (a delegate) Fill a data array Use the array to populate a list view Show the list view I have all of the components in place but after the web service call is made, the program doesn't wait for a reply (asynchronous call) and instead fills the list view with blanks since the data array is not

is it good practice to share the ADD and EDIT screen to use the same UIViewController?

孤人 提交于 2019-12-24 09:58:22
问题 is it good practice to share the ADD and EDIT screen to use the same UIViewController? That is in the case where the only real difference would be in one the values would be populated with existing (EDIT). PS. Some clarification. So perhaps take the simple case where there is just one or two NSString fields (e.g. title & description) - so is there anything wrong (e.g any gottchas) associated with using the same controller/NIB(view) for both EDIT and ADD? 回答1: Not sure about "good practise",

'UIViewController' is not a subtype of 'ViewController'

一世执手 提交于 2019-12-24 09:16:58
问题 I am using a tab bar controller and I'm trying to access the defaults from my other tab bar view controller. I tried this in a different function, also shown below, and it works perfectly, but for some reason it isn't working here. It puts up the error whenever this is called: FirstViewController().defaults . Does anybody have any idea why this is happening? func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{ let cell = TableView.dequeueReusableCell