w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to dismiss view controllers at any time (even during transitions) or when it is safe to dismiss a view controller ?
It seems like you are trying to dismiss the view controller when it is not currently on screen. To check if it is on screen you could use: if (self.presentedViewController.view.window) { [self dismissViewControllerAnimated:NO completion:nil]; } else { self.presentedViewController = nil; }

Categories : IOS

Dismiss View Controller without cascading all the way to root View Controller
I guess you should call: [self dismissViewControllerAnimated:YES completion:nil]; Have a try. My guess is based on Apple's doc: The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, it automatically forwards the message to the presenting view controller. So if you call dismiss on self.presentingViewController. Then B will dismiss!

Categories : IOS

Add a child view controller's view to a subview of the parent view controller
It don't really matter to which view you are adding the child viewController. If a view of a viewController is added to another viewController you need set it properly. tableViewController.view.frame = self.contentView.bounds; [self.contentView addSubview:tableViewController.view]; /*Calling the addChildViewController: method also calls the child’s willMoveToParentViewController: method automatically */ [self addChildViewController:tableViewController]; [tableViewController didMoveToParentViewController:self]; Source code

Categories : IOS

how to rotate parent view controller when child view controller orientation changes in iOS
Hey if I have understood your problem correctly, than you may want to look into this superb method from UIView. - (void)viewWillLayoutSubviews When a view’s bounds change, the view adjusts the position of its subviews. Your view controller can override this method to make changes before the view lays out its subviews. The default implementation of this method does nothing. So this method will get called before every subsequent rotation of your Child View Controller and you can post notification to your parent view controller from this method.

Categories : Iphone

Warning: Attempt to dismiss from view controller (UINavigationController) while a presentation or dismiss is in progress
This warning can happen if the SecondViewController is dismissed with a call to (void)facebookUpdated:(NSNotification *)notification before the animation to make it appear in the first place has finished. You can: Ignore the warning Avoid it by not animating the display of SecondViewController if it is likely to be dismissed right away. Avoid it while still allowing animation by setting a callback on the initial view controller animation that calls a function on the second view controller telling it that the animation has finished. Then you can check for this property in (void)facebookUpdated:(NSNotification *)notification before calling dismissViewControllerAnimated, and, if the load hasn't finish, set another flag to have the original animation callback function call dismissViewContr

Categories : Objective C

Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress
You can add another view controller on top of the existing one by calling pushViewController: [self.navigationController pushViewController:newViewController animated:YES];

Categories : Iphone

MvvmCross iOS: how to dismiss a view controller when use IMvxModelTouchView
I suspect you are probably using the standard MvxModalSupportTouchViewPresenter which only expects one modal view/viewModel to be displayed at a time, and which expects that view/viewModel to be cleared using Close(this) from the ViewModel. See: MvxModalSupportTouchViewPresenter.cs#L29 If you have strong ideas about your UI, then (in my opinion) your best bet is to write your own custom presenter - then you can open/close/hide/show whatever you want. For more on writing custom presenters, see some of the links and videos from: http://slodge.blogspot.com/2013/06/presenter-roundup.html

Categories : IOS

Cannot dismiss Modal View Controller after trying several options
Your problem (based on your comment) is you are technically not using a modal, you are using a subview! If you want to use a modal you need to do: [self presentModalViewController:self.fav animated:YES]; to present your controller, instead of: [self.view addSubview:_fav.view]; Then your dismissal will work (many of your solutions will work): [self dismissModalViewControllerAnimated:YES]; Otherwise if you do wish to use a subview you would need to do this to remove it: [self.fav.view removeFromSuperview]; (It also looks like you are using ivars. If you wish to keep using them then replace self.fav with _fav)

Categories : IOS

Dismiss UITabBarController and Push Sign In View Controller
You have 2 choices: 1) Present the login view controller from the tabbar Controller [self.tabBarController presentViewController:loginViewController animated:YES]; 2) Each time change the root view controller of your application window: [[UIApplication sharedApplication].window setRootViewController:tabBarController]; and then: [[UIApplication sharedApplication].window setRootViewController:loginViewController];

Categories : IOS

How can I dismiss view controller or unwind from it from NotificationCenter observer?
What I would suggest is just dismiss the VC when the notification fires and handle the UI mishap in viewWillAppear of your parent controller/presenting controller - VC A. This code should be in B if I am not wrong - (void)getPlaceInfoFailed:(NSNotification *)notification { [self dismissViewControllerAnimated: YES]; or try [self dismissModalViewControllerAnimated:YES]; //dep'd in ios 6. }

Categories : IOS

How to add child view controller's view over the parent view
A few observations: You should turn off translatesAutoresizingMaskIntoConstraints: childviewcontroller.view.translatesAutoresizingMaskIntoConstraints = NO; You should define vertical constraints, too: [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[cview]-|" options:0 metrics:nil views:viewsDictionary]]; Unrelated to your problem, you don't need to create the [[UIView alloc] init] for cview. You're immediately discarding it. I'm not sure why you're removing the constraints for self.view. (I'm presuming you did that

Categories : IOS

Dismiss view controller from @selector without creating seperate method
It won't work like that. From the documentation of UIControls addTarget:action:forControlEvents:: The action message may optionally include the sender and the event as parameters, in that order. So you have three possible selectors: @selector(name) @selector(nameWithParam:) @selector(nameWithParam: otherParam:) if your selector is @selector(dismissViewControllerAnimated:completion:) it will be called with the sender instead of the animated BOOL and the event instead of the completion handler block which will crash you app. edit to clarify why it crashes: dismissViewControllerAnimated:completion: copies the completion block by sending the copy message. The event object doesn't implement copy and you will get an NSInvalidArgumentException.

Categories : Iphone

Copying single iPhone view controller to iPad view controller gives lock icon/ doesn't work
@koregan's advice has worked for me. 1) Duplicate your iPhone-Storyboard and rename it MainStoryboard_iPad.storyboard 2) Open this file any text editor. 3) Search for targetRuntime="iOS.CocoaTouch"and change it to targetRuntime="iOS.CocoaTouch.iPad" 4) Now save everything and reopen Xcode -> the iPad-Storyboard contains the same as the iPhone-file but everyting could be disarranged

Categories : IOS

Animation of Back-Button broken after dismiss of Modal View Controller
I found the problem. I had subclassed the UITabbarController and I have added a -(void)viewWillAppear-function where I have put some logic. Unfortunately I forgot to add the [super viewWillAppear:animated] call inside of that function. Very stupid mistake. Thanks to rdelmar, who pointed out the possible cause for this in the first comment of my question.

Categories : IOS

How to use `calloutAccessoryControlTapped` is touched correctly to send data from one view controller to a detail view controller
detailViewController.listingId = theAnnotation.catListingMapId and in detailViewController find the other details by listingID EDIT: in @interface MyAnnotation write a method: - (NSDictionary *) getTheAnnotationData{ NSDictionary* theDict = [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat:@"%f",latString],@"latString", [NSString stringWithFormat:@"%f",lngString],@"lngString", [NSString stringWithFormat:@"%i",catMapId],@"catMapId", [NSString stringWithFormat:@"%i",catListingMapId],@"catListingMapId", title,@"title", subtitle,@"subtitle", nil]; return t

Categories : Iphone

Adding a root view controller OCMockObject[UIViewController] as a child view controller error
I've run into the same issue. I'm guessing that your properties bottomMenu, topMenu, and mainScreen set bottom, top, and main as child view controllers of the other view controller. Unfortunately, addChildViewController: looks at some value in the UIViewController* structure. Since it's a direct memory access and not a method call, the OCMockObject can't intercept it. As a result, the mock object is (sometimes) treated as being a root view. The way I found around it was to override addChildViewController: on the object I was testing in the test file and have it do nothing: @implementation MyViewController (overwriteForTesting) - (void)addChildViewController:(UIViewController *)childController { } @end This means that it won't add the view controller to its list of children though.

Categories : IOS

How to remove split second white screen between dismissing a view controller and loading a new view controller
check out this code:- self.view.backgroundColor = [UIColor clearColor]; self.modalPresentationStyle = UIModalPresentationCurrentContext; [self presentModalViewController:modalVC animated:YES];

Categories : IOS

using a view for multiple controller Actions, return to initial view
sorted! 1.I added a viewbag action 2.Used that viewbag in the querystring for edit 3.put the querystring in a hiddenfield 4.got the fieldvalue on form post and redirect to action of the field value Thanks for the help

Categories : Asp Net Mvc

objective c - resident and dirty memory not getting released after dismiss of collection view controller
Some suggestions: Make sure you set all your IBOutlets to nil on your views -dealloc method If you're using view controller containment, call -removeFromParentViewController: - (void)removeSubViewsOfView:(UIView *)view{ NSArray *viewsToRemove = [view subviews]; for (int i = 0; i<[viewsToRemove count]; i++) { UIView *v = [viewsToRemove objectAtIndex:i]; [v removeFromSuperview]; NSViewController* vController = nil;//retrieve your view controller [vController removeFromParentViewController]; v=nil; } } It won't generate dirty memory, but it may leak objects if you keep mutual strong references between objects, aka. A retains B and B retains A Hope it helps :)

Categories : Objective C

Pass data between table view controller to detail view controller using Parse.com
Assuming you have a a Recipe class in the Parse backend, you should be able simply replace the code in your initializer that creates the recipes with a Parse query to retrieve them instead. Something like the following (note I haven't exactly checked syntax): PFQuery *recipeQuery = [PFQuery queryWithClassName:@"Recipe"]; [recipeQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { self.recipes = <Map parse objects to Recipe objects here>; } }]; If you map the returned Parse objects to Recipe objects, you shouldn't need to change any of the rest of your code, apart from dealing with the delay in loading content over the network (you'd probably want to display some kind of loading indicator to the user). Alternatively, you could

Categories : IOS

Set a Variable in one View Controller and Access it in another View Controller based on a Button Pressed
A better approach may be to create a class which is the data model for your common data. In this case it's just the float value for your timer. Create an instance of the model class, and then add a property for the object in each of your view controller classes. When you instantiate the view controller, set it's property to point to the model object. Hopefully that makes some sense?

Categories : IOS

How can I test if a current view controller is the first responder/top most view controller once a application becomes active
If you're using a navigation controller you can access it using navigationController.visibleViewController

Categories : Iphone

Pushing details view controller on list view controller presented in UIPageViewController
@alexbumbu is right the best way is not to over-combine with UIPageViewController and use separate UINavigationControllers for every page stack flow. That was my choice

Categories : IOS

Access text from UITextField in modal View Controller from Home View Controller
When I ran into this problem, I chose the singleton approach and it works.

Categories : IOS

UIScrollView shift down 44px (equal navigation bar height) right after dismiss modal view controller
I have also the same problem on iOS 6. The problem seems to be solved on iOS7GM. Look here for a solution : Shifting view after displaying modal - possibly AutoLayout related

Categories : Iphone

How to call method on presenting view controller from modal view controller
You call the method on the UIViewController that is your MainView, and pass it your UIViewController you want to be the ActionSheet. UIActionSheet *actionSheetController =[[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"show otherview", nil]; [self presentModalViewController:actionSheetController animated:YES ]; To dismiss the UIActionSheet, dimissWithClickedButtonIndex:animated: is a method for the UIActionSheet that you can implement. The method can be called by whoever (so if you want to dismiss it from your mainview have a reference to the action sheet and do something like -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { { switch (buttonIndex){

Categories : IOS

Passing data from one view controller to other view controller through xib file
Sorry , I couldn't get why you have done these two line code : tempView.fullName = self.nameTextField.text; [tempView setFullName:self.fullName]; Instead , Make a property of NSString in Second View Controller's .h file @property (nonatomic,retain) NSString *strFullName; and synthesize in .m file. @synthesize strFullName; Now , -(IBAction)nextVCButton:(id)sender { SecondViewController *tempView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; NSLog(@"name : %@",self.nameTextField.text); tempView.strFullName = self.nameTextField.text; [self.view addSubview:tempView.view]; }

Categories : Iphone

Setting variable in one view controller for another, and swapping to that view controller
You seem to have added a view controller that you don't need. The error is because you never show that view controller and then try to present another view controller from it. Take the code in SegueInsert and move it to SeguqInsert. Then delete the CalendarMonthViewController (which presumably isn't doing anything else and has no other code).

Categories : IOS

Add objects to an NSMutableArray in my base view controller from a second view controller, ios
I would recommend using a singleton instance of your NSMutableDictionary as they have bailed me out of your exact situation multiple times (including custom frameworks and UITabBarControllers). Here is an example I'm currently using to implement a singleton. This methodology is also ARC-safe as well mySingleton.h #import <Foundation/Foundation.h> @interface mySingleton : NSObject { } + (NSMutableDictionary *) myMutableDict; @end mySingleton.m #import "mySingleton.h" @implementation mySingleton + (NSMutableDictionary *)myMutableDict { static NSMutableDictionary *singletonInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ singletonInstance = [[NSMutableDictionary alloc]init]; }); return singletonInstance; } @end

Categories : IOS

JASidePanelController and update switch state in center view controller after turning off a switch in left view controller
Key Value Observing(KVO): allows any object to observe a property of another object which the observing object is notified when that property’s value changes. It learns about the new value as well as the old one. It helps apps become more cohesive by by keeping objects in the model, controller, and view layers synchronized to changes Introduction to KVO link

Categories : IOS

Why NSInteger cannot set from parent view controller?
Just declare simply, as @property NSInteger currentItemIndex; And if it dont solve the problem, you have to tell where you declare the property, which class, in interface declaration or not, which xcode you are using etc. post more code. e.g. for xcode 4.6 this is okay. but for old xcode you have synthesize the property.

Categories : IOS

Can't access parent view controller's variables
The problem here is that you're using self.textEventName.text to access the textEventName property in Parent.m, but you're only using textEventName.text in Child.m. That's meaningless -- it's the equivalent of this: [[ textEventName] text]; // Error: you're not specifying the receiver of the message If you want to access a property of an object, you need to specify which object. In this case, that object is self. Change the code in -displayParentStrings thus: NSLog(@"DeleteFromCalendar Event Name %@", self.textEventName.text); NSLog(@"DeleteFromCalendar Event %@", self.textEventLocation.text); Adding self. will solve your problem.

Categories : IOS

Strongly Attributed Property in Master View Becomes Null After Callback Delegation from Detail View in Split View Controller
Based on the comment conversation under the question one possibility is that inconsistent variable naming might be the problem. It looks like you might have "@synthesize idSearchBar = searchBar;" in your implementation so self.idSearchBar and searchBar are effectively the same thing. The problem with this is a local variable called searchBar somewhere else in your class could overwrite your instance variable. So try this: Change the synthesize line to "@synthesize idSearchBar = _idSearchBar;" or remove the @synthesize line completely and let the compiler auto-generate that exact line for you (if using LLVM compiler 4.0). Change all searchBar usage that show up as an error to "self.idSearchBar" to be consistent throughout your class. Any leftover uses of searchBar will be local variables

Categories : IOS

What would be more efficient to load content on a detail view from a view controller with a table view?
It's not totally clear from your question where the data is coming from. I'm assuming because you mention a JSON call that when you select an item on your table view you need to make a web service call to fetch additional information about that item before displaying your detail view. If that's the case then you should make the web service call and load the data whilst in the detail view controller. Apple's interface guidelines recommend you do it this way to give the appearance of responsiveness. The detail view controller will be displayed immediately after the row in the table view has been tapped. You can use an activity indicator or loading graphic in your detail view to let the user know additional information is being downloaded. This is a considerably better experience than waiti

Categories : Iphone

Passing data from a parent to child controller to a view
You need to create a class property to have it available to the child class: class Backend_Controller extends MY_Controller { public $data; public function __construct() { parent::__construct(); $this->data['cms_name'] = $this->config->item('cms_name'); } }

Categories : PHP

Using view controller containment, children lose parent
I fixed it by moving currentVC = newVC; into the completion block. SwapViewControllers: now looks like this: -(void)swapViewControllers { NSLog(@"top current VC parent = %@",currentVC.parentViewController); NSLog(@"top new VC parent = %@",newVC.parentViewController); [currentVC willMoveToParentViewController:nil]; newVC.view.frame=childContainerView.bounds; [self addChildViewController:newVC]; NSLog(@"current VC parent = %@",currentVC.parentViewController); NSLog(@"new VC parent = %@",newVC.parentViewController); [self transitionFromViewController:currentVC toViewController:newVC duration:1.0 options:UIViewAnimationOptionTransitionCurlUp animations:nil completion:^(BOOL

Categories : Iphone

Forward a UIGestureRecognizer from one view controller to another view controller
EDIT: Now the delegate get the argument with the gestureRecognizer. You can just implement protocol like: @protocol ViewControllerWithGestureRecognizerDelegate - (void)viewControllerGestureRecognizerEvent:(UIPinchGestureRecognizer *)gestureRecognizer; @end and add the delegate property to the view controller in which there will be presented gesture recognizer. @property (nonatomic, weak) id<ViewControllerWithGestureRecognizerDelegate> delegate; Then add the gesture recognizer to your view Controller: UIPinchGestureRecognizer *gestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(gestureRecognizerAction:)]; [self addGestureRecognizer:gestureRecognizer]; Call the delegate method in action method of the gesture recognizer: - (void)gest

Categories : Iphone

Why can't this view controller set the text fields of the next view controller?
I usually get this too (in the example of when using segues). I get around it by setting an NSString property instead of an IBOutlet during prepareForSegue of the destinationController. Then during viewDidLoad of the next View Controller, I take the value of the property and assign it to the UILabel. You may find the explanation in this answer useful: http://stackoverflow.com/a/8094146/2358334 If you set a breakpoint just after the line you call testViewController *viewController = segue.destinationViewController; when you build and run the project, you will find that the UITextField property in the destinationViewController is not allocated and initiated (memory is 0x0) at the breakpoint. Meanwhile the NSString property is already allocated and initialised (so you can

Categories : Iphone

How to get the screenshot when a view controller is presented over another view controller?
Well you can simply add ViewOnTop.alpha = 0.0; to the view which is above the one of which you want to take a screenshot. This will first make the View on top reduce its alpha property to 0 thus making it virtually transparent and then you are taking the screenshot Add the above code here - (UIImage*)screenshot { ViewOnTop.alpha = 0.0; ............ ................... } EDIT : For the viewcontroller in the same code add the dismissViewController property to the view that is being presented so that finally the view of which you want the screenshot is visible.

Categories : Iphone

Login View Controller over modal View Controller
This is b'coz you R trying to present the VC while it is actually loaded as RootViewController . Try using this : UISplitViewController : Once loaded the Root and as well as MasterViewControlller , You will make the UIViewControllers as SubViews for Your RootViewController.. From the UIViewController , If you want to revert back to the RootViewController , Try this : [self.navigationController popToRootViewControllerAnimated:NO]; I just thought your problem is similar. Hope it helps.

Categories : IOS



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.