I am new to iOS programming. I am quite amazed at the power and ease of collection view. But I have a problem.
I have a "home" view controller - A, which is UICollectionViewController. I have a left button (like Facebook on the navigation bar) and I redirect to another view controller using
[self.navigationController pushViewController:controller animated:YES];
When the user presses the back button, the "home" view controller appears. And viewWillAppear and other collection view delegate/datasource methods are called. but table is frozen. It does not scroll, do anything.
But if on the left button i press the "home" button, then viewWillLoad and other methods are called and the collection view works.
I do not have any code in viewWillLoad. I have moved everything to viewWillAppear to test.
Please help
Related
I have a List view and a Detail view.
In list view, I have set up the jquery infinite-scroll plugin.
When a user clicks an item, I render the detail view. The problem is when the user hits bottom of the page, the infinite-scroll callback is fired.
I tried calling $.infinitescroll('pause') but it won't stop the fetch.
Should I completetly destroy the list view before rendering the detail view?
If so, how can I completely destory it? (I tried https://stackoverflow.com/a/11534056/433570 but didn't stop the infinite-scroll callback)
My code resembles https://github.com/joshbohde/django-backbone-example in a big picture
Have you tried doing event.stopPropagation on the scroll event inside the Detail view?
I am having an issue when im using navigation controller. My program is laid out where I have a start screen (not in the navigation controller) and then when you press a button it sends you to the navigationController and new view.
How can I call the navigation controller from the start screen?
Pushing a view controller will only work if the view controller pushing is contained in a navigation controller. You can try to hide the navigation bar in the pushed view controller: how to hide navigationbar when i push from navigation controller?
If you still want to keep your structure, the possible solution would be to present the navigation controller with table view controller as a modal. You need to use the presentViewController:animated:completion: method in the start view controller:
[self presentViewController:theTableViewController animated:YES completion:nil];
in AppDelegate.h class
Create a property of UINavigationController like:
#property (strong,nonatomic) UINavigationController *navigationController;
and in give it as a RootViewController in AppDelegate.m like:
self.navigationController = [[UINavigationController alloc]initWithRootViewController:self.viewController];
and give it to Window like:
self.window.rootViewController = self.navigationController;
Thats it!!! You are Done!!
Now you have navigationController at the root as well.
Cheers!!
If you don't have any problem in adding first controller to UINavigationViewController then do the following to do this just from interface builer :
1) Select first view controller in storyboard.
2) From menubar select Editor -> Embed In -> Navigation Controller.
[This was posted on the Apple Developer Forums but has not been answered, so I'll try here.]
My application uses a UISplitViewController for iPad master/detail views and runs on iOS 6. The split view controller is the root view controller for its window. The detail view consists primarily of a UIWebView embedded in a UINavigationController. The only other elements in the detail view are the toolbar and navigation bar offered by the navigation controller. When the web view is displaying a page with an embedded YouTube video, the user can make the video full screen. This is all done by the UIWebView---I am not responsible for creating a full-screen video player. In case it matters, once the video player is placed in a full-screen view, the keyWindow of the UIApplication shared instance is not the main application window during video playback, but is instead an instance of MPFullScreenTransitionViewController.
If the user rotates the device during this full-screen playback, and then ends playback, the UISplitViewController does not properly place its children. The methods
splitViewController:willHideViewController:withBarButtonItem:forPopoverController:
and
splitViewController:willShowViewController:invalidatingBarButtonItem:
of the delegate (in this case, the detail view controller) are never called.
If the device was rotated to a landscape orientation while playing full-screen video, dismissing the movie player results in the presentation of a detail view controller that retains its former bar button item to draw the master view controller in a popover (although tapping the button produces no action). Where the master view controller should be drawn, only a black region exists. Swiping right in the detail view controller will slide out the master view controller that covers the black region, but this still exists as a popover rather than a persistent view.
If the device was rotated to a portrait orientation while playing full-screen video, dismissing the movie player results in the presentation of a detail view controller that lacks a bar button item to draw the master view controller in a popover. The detail view controller has the correct width, and the master view controller is not visible, so the appearance of the detail view is almost as expected except for the missing bar button item.
In both cases, manually rotating the device after the incorrect view appears will restore proper application functionality. However, relying on the user to rotate (or double-rotate) the device to fix drawing problems is clearly unacceptable.
Is there some way to ensure that the split view controller becomes aware of device rotations when all of its children have disappeared behind a modal movie player?
The answer was suggested by user SamuraiZack on the Apple Developer forums. In the delegate for UISplitViewController, force relayout of the split view controller in viewWillAppear:
[self.splitViewController.view setNeedsLayout];
[self.splitViewController.view layoutIfNeeded];
The original response can be viewed on the Apple Developer forums.
There is a Marionette ItemView which is rendered correctly the first time as a bar at the left side of the window. The side bar can be hide and it happens correctly by calling the close method of the view. However, when I want to show the side bar again I create a new instance of the view and show it in the region it is not displayed. The initialize method is called as well as the onShow but the elements are not added to the DOM thus they are not shown in the screen. Thanks for your help in advance
The iPad app that I'm working on makes use of Storyboards and segues. I'm trying to display a different view controller when the user clicks on different cells in the master view.
After referring to different tutorials, the steps that were taken were -
In the Storyboard, Master View Controller, created static cells for the table view and added 3 different rows (i.e. cell 1, cell 2, cell 3)
Added a View Controller, selected it and attached a Navigation Controller to it (Editor -> Embed In -> Navigation Controller)
From cell 1 in Master View, I did a ctrl-click on the Navigation Controller.
Chose Segue Style "Replace" and Destination "Detail Split"
In tableView:didSelectRowAtIndexPath, added [self performSegueWithIdentifier:#"NewViewController" sender:self] to do the transition.
The result that I see is the detail view gets replaced.
But the navigation bar does not have the bar button item Master.
So I'm unable to click the Master button which would show the table containing cells from where I can navigate to a different view.
I've already read many blogs and seen commentary which talk about replacing a segue for similar problems. However nobody seems to have faced this specific issue while using storyboards and segues.
From my understanding using segues should help me achieve what I want. From those who have tried this approach, any pointers in the right direction will be helpful.
Try changing the Segue Style from Replace to Push. It should resolve your problem.
When you push a UIViewController on a UINavigationController, it will be added to a stack and you will be able to navigate back :
Your navigation controller stack before tapping "Detail":
Master
Your navigation controller after tapping detail and navigating a little more ...:
Master -> Detail (Navigation button is displayed) -> Some other details (Navigation button is displayed) -> And maybe some more (Navigation button is displayed)
When you call a new segue using Replace like you did, the Master will be replaced with Detail, and you will not be able to navigate back because Master was replaced and it's not on the stack anymore.
Your navigation controller stack before tapping "Detail":
Master
Your navigation controller after tapping detail using replace like you did:
Detail (no navigation button because master was replaced and we don't have nothing more on the stack)