Hiding the Root View of a UISplitViewController - ios

For the app that i am developing i have used a UISplitViewController as my base, but have modified, or attempting to modify the split view controller like that of Alice Bevan–McGregor's on http://vimeo.com/13054813. However in my app i have a table view with a list of options, and every time i click on an option it loads the corresponding detail page from a detached nib file. So, at the start of my app i can see and use the hidesidebar fine though it displays a white page. when i choose an option, the toolbar is overridden by the corresponding nib, so it dissapears. What i am not sure about is how to connect it in a way that it appears on every page(nib) everytime i choose an option from the tableview. I have been stuck with this problem for quite a while now.
essentially i would like the toolbar to maintain its functionality no matter what page i am on.
Anyone have any ideas?

May be you should give a try to this http://mattgemmell.com/2010/07/31/mgsplitviewcontroller-for-ipad
It has the following method
- (IBAction)toggleMasterView:(id)sender;
My own implementation of custom splitview using navigation based app # https://github.com/palaniraja/cUISplitViewController
Also try Salva's implementation http://iphone-dev-tips.alterplay.com/2011/05/custom-uisplitviewcontroller-for-ipad.html

Related

How to launch a custom UIView as a Dialog iOS

I'm working on a Dialog for my iOS app, and have decided that the default boxes don't allow for the level of customization I am looking for.
So, I have created a view inside a storyboard. It is embedded in a view called DialogBoxView inside DialogLayout.storyboard with a view controller called DialogLayoutViewController.
In short, I want to be able to open the specific view as a Dialog. (Like this below.)
But, as previously mentioned, I want the View inside the Storyboard to inflate as the dialog's layout.
What I need is a way to call into the ViewController handling the Storyboard [I can do this] and open the specific DialogBoxView inside.
See:
My Hierarchy
See:
My Layout
Please note that I have browsed around a bit on Google, and nothing is useful. It is either outdated (OBJ-C) or not what I really need.
Additionally, is it possible just to (like in Android/Java) "inflate" the View layout as the Dialog's view?
Summary:
Can anyone give me an example on how to inflate a specific view (inside a Storyboard) as the dialog programmatically from the ViewController?
I'm still kinda new to Swift and iOS development in general, and I have come across some functions that may work, I just can't put them together in a way that actually works.
NOTE: I have found a way around custom layouts, but am still curious as to how this might work.
Swift 5
Some time ago, I created one project similar: You can see in: https://github.com/MaatheusGois/custom-alert

cellForRowAtIndex not being called in UITableViewController?

I've currently got a single working UISearchController implemented inside the header view of a UITableViewController. I wish for my other views to also follow suit but some are UICollectionViewControllers. Is there a way to create one UISearchController and just call them across all the views within the headers? All of the results must show in a table.
I had attempted to create one for each view but the UICollectionViewController was giving me some problems. I couldn't figure out how to set and update a table for the search controller. It wouldn't allow me to override the tableView methods as i guess the controller is a CollectionView.
Any help is appreciated.
EDIT:
Should also add that the search method/data will be the same across all of the views. See how the stock iOS Music app uses search bars as an example.
EDIT 2:
I've nearly cracked it (I think). I've setup a singleton "SharingManager", within this i have 3 arrays. Now I have 2 views, one named ArtistsView and one SearchTableViewController. The Search view contains all of the table methods and the ArtistsView communicates with that using:
self.searchResultsController = UISearchController(searchResultsController: SearchTableViewController())
I also copy the variables within the singleton to variables that are within the SearchTableViewController.
The issue i'm having now is that the cellForRowAtIndexItem method is not being called. All the other ones are, i can even see the section headings are being displayed. I have set up various println() statements to see where i could've gone wrong, the numberOfRowsInSection is also returning the correct numbers. Any ideas?
What I have done in the past to solve this kind of issue, and what seems to be the most flexible is to have it so that when you tap on the searchbar, your app actually transitions to another view controller that handles the search and search results.
Fake search bar button on each screen you wish to use it.
When tapping the search bar, screen cap your current view controller.
Set the screen cap to the background of your search results controller, blurred or darkened a bit if you like, so it doesn't interfere with the search results.
Transition between your previous view controller and the new search results controller with a fade.
You'll be able to give the user the impression that they never left the original screen they were on.

How to write to a sidebar menu from another view

I have an app where there is a sidebar menu. Like the Instagram and Facebook apps, I have a user settings view, where I can upload a picture. This picture is also shown in the sidebar menu. This picture is loaded once, when the sidebar menu tickers viewdidload.
The problem is if the user changes the image in the user settings view, I can't get it to update the sidebar menu. The viewdidload runs only once.
The best thing would be if i could set the UIimage in the sidebar from the user settings view - but is this even possible?
I not that good at Xcode (swift) yet so bear with me.
Without code samples or knowing the implementation of your sidebar these are just guesses. viewDidLoad is only called once when the view is added to the hierarchy. Try moving logic that needs to execute on each subsequent appearance to viewWillAppear.
In the past when I've implemented a sidebar, I've used a UITableView or UICollectionView. This simplified determining what was selected and reloading the state/data of the view as you're using well defined delegates and methods. This worked well for me but YMMV.
The best thing would be if i could set the UIimage in the sidebar from the user settings view - but is this even possible?
It is probably best to keep your sidebar and settings view separate. They don't need to know that the other exists. This doesn't mean they shouldn't share the same data or an abstraction (service class, plist, etc) over that data.
You have several possibilites to get this done. A non exhausting list:
NSNotificationCenter
Key Value Observing
Delegation
Make your menuVC a delegate for the viewController where your profile-image-change action can be performed. When someone changes the profile-image, call:
delegate.profileImageDidChange()
In your delegate protocol, you have to define that method of course. Please see the tutorial on Delegation (Hyperlink). If you need more help with implementing it into your code, just ask another question or edit your question.

Using a tabbar for controlling the tableview data in iOS without using storyboards

I am building an app which mainly shows a tableview. In this tableview I have some custom table rows. The table rows are filled with data received from the server. I receive multiple kinds of data from the server. I will store it in arrays.
For example, I've got three kinds of arrays. Each is filled with different kinds of data received from the server. See below:
(NSArray*)carList_
(NSArray*)motorcycleList_
(NSArray*)bicycleList_
The actual program that I've got now, only shows the carList in the tableview. Foreach car in carList, there is a table row.
The thing that I've in mind to do is a little bit tricky. I want to add a tabbar at the bottom of the screen with three buttons. When I press the first button, I want the table to be filled with the carList. When I press the second button, I want to fill the table with the motorcycleList. And when I press the third button, I want to fill the table with the bicycleList.
As you can see, I will use the same tableview. I will only refill it with the data I want to see. Is this allowed in iOS? Cause I read something about that the tabbar is for multiple views, and I only want to use it for changing the data in my table. Only the fourth button I've planned for future development will open a new view. If it is not allowed, what is a good alternative do do it? Buttons maybe? I searched the web for what I want to do, but it seems that my idea has never been used before, I think my idea is not allowed in iOS.
At this moment I've a initialViewController (with almost no code cause it is used only to initialize some things of the server. It acts like a splash screen) and I've got a rootViewController which does the works. In the rootViewController I've got my Table with Table rows and it has the different arrays of data which are retrieved by a method that is called when the rootViewController is loaded.
I am programming without Storyboards, because I'd like coding and I want to understand how it works 'underground'. What is a good way to implement the tabbar if it is allowed what I want to do with it? I don't think a standard tab controller will work, because I am working with only one view.
Of course you can use the UITabBar solution. However this might be not very useful and this is not the idea behind the UITabBar. You can instantiate the same TableViewController vor each tab. In this case you can use the same class but you have up to the instances of this class when the user cycles through the tabs. This will be obvisously a waste of memory.
Your descriptions sounds like a UIToolBar with a UISegmetenControl in it might fit your needs better. You can also place it at the bottom of the screen and you will need just one TableViewController for your data.
UISegmentedControl is designed for switching between different data representations. It is also commonly used for switching between table datasources. But it often appears at the top of a view. Take a look at Top Charts tab of App Store app.
Tab bar is designed to present different views for each tab. Here are progress steps to achieve your result:
Use different instances of table view controller for each tab
Configure each instance for displaying one particular array, depending on tab position
Keep arrays in external (outside table view controller) storage, instances should have an access to it
It's better to preload data, while user is examining an active tab. Hence, load data outside of table view controllers, possibly in AppDelegate. Use notifications to update table view when data are available.

iOS: UI Ideas for moving items between multi-level tableViews

I am building an iOS app that allows the user to browse a tableView, click a cell, then navigate deeper into another tableView using a navigationController.
I have a requirement to be able to move any of those items/cells to another place in the navigation stack. Right now my idea is, once the user selects the cells to move, to display a modal tableView that will allow the user to navigate through the same structure as before, but this time choose the location (by pressing and holding) to place those cells.
Are there any other UI ideas or clever programatic ideas that anyone might have that could be a better solution to this problem?
Perhaps take a look at how Apple's iOS Mail moves email messages between different mailboxes?
This also basically displays a modal view controller, but it flattens the hierarchy, by indenting nested items below their parent objects. You than just select the item that is the destination.
This of course only works if your hierarchy is not too deep, otherwise it's probably best to do it like you outlined it. The only thing I would perhaps recommend doing in addition, is to also have some sort of visual method (button?) to select the destination. A long press by itself might not be intuitive enough.

Resources