I have two UITableViews but they appear in the same UIViewController. That said, one acts as a reveal (slide out) side menu, and its code is housed inside SideMenuViewController.h/.m, and the other TableView is constantly visible in the ViewController.
I'm trying to make it so that I can long press on a cell in the side menu, and drag the selected cell into the TableView on ViewController.
Is this do-able? I've been searching high and low for tutorials, but this doesn't seem like a common ask. Open to all assistance.
Related
I am developing Sliding tab layout with the help of Swift 1.2. Sliding tab must have single UITableView.
UITableView will be refresh when I slide / move the tab.
I have tried many tutorials from other sources, but could not get proper hint as most of tutorial used separate ViewControllers for each tab. What i want is, to use single ViewController with one UITableView for all tabs.
How to achieve this in iOS - Swift?
Implement a pan gesture recognizer on your tab view, track the movement to next tab on that view. When it does, reload your tableview's data.
So my problem is the following:
I have a UIViewController, in it I have defined a UIPageViewController and added its view to the hierarchy and on top of that I have added an UITableView.
What I would like is to be able to scroll my UITableView (that part works) but also to be able to swipe to change the slides of my UIPageViewController.
My problem is that the UIPageViewController doesn't detect the swipe gesture at all. If I remove the UITableView it works all right of course.
My question is the following: is there any way to pass the swipe events from the UITableView to the UIPageViewController so both would receive their intended gestures ?
You would need to have the tableView inside your page view (in the content view controller for a specific page).
If you have two views on top of each other the front one will intercept all the touches and no actions will make it through to the lower views.
Try setting user interaction on the tableView to false to see what I am talking about. Of course this will cause the tableView to become unresponsive. You will need to implement this a different way.
The way to put a Header to UITableView in a storyboard is explained in another thread, that you drag and drop your component (in my case a view) on top of the first proto cell. That sticks than as tableview header (not section)
My Problem is, if you drag and drop e.g. a SearchBar and run the app, the seacrh bar is behind the NavigationBar, you can pull the tableview down and you see the searchbar.
If you do the same with a view, you can never put the view away with scrolling up the tableview, it is always visible.
Does anyone know how to hide it like as the search bar ?
Might be this answer is too late but for others maybe useful
after i googled it, i ended with this question , and yeaaa this save my day
Click here
Im building my iphone application and this is how my storyboard looks right now.
First question: Adding another table view
My first two tab bar items are going to contain table views. Now as you can see i have my first table view connected and all, how would i do to get the empty view under Navigation Controller to be a a Table View. Would i need to add another Navigation controller? or how does it work cause i have never worked with tabbars/tableviews before.
Second question: Customize prototype cell
My first Table View can show the data that i inputed as you will see in the following picture. The first picture is how its currently being shown. How can i make a custom prototype cell that would look like the second picture?
Please not that the cells will be very much alike each other in both of my table views. I will have an if statement where i will check a specific thing and if its true it will hide for example the image but all the other things would be the same so would i make a class for the cells?
For better solving your questions, You must first understand the purpose of Navigation Controller. Navigation Controller is there for you to push and pop between controllers, which is convenient when you have levels of data. It manages a stack of controllers. You don't always need a navigation controller to work with tableview. However, it's a common practice to put Navigation controller and TableView (with view controller or solely UITableViewController) together for easy showing levels of data.
Basically, there are two ways to add a TableView. You can directly drag a table view onto your empty view controller or delete the empty VC, then drag a UITableViewController. Most importantly, select the whole VC and go to Editor (at the top) choose embed in a Navigation Controller.
Link about navigation controller from Apple's document
Since you use storyboard, you can directly customize your tableViewcell in storyboard. You already have a prototype cell. You can now directly drag UIImage or Label on that. Most importantly, create a class subclassing UITableViewCell and connect objects in your tableViewCell as an IBOutlet so that you can control it. If you feel plain text explanation is not enough, I find a tutorial for you.
You could refer to the link section Prototype Cells.
1) Yes you will need a 2nd navigation controller for each tab.
Delete the UIViewController.
Drag a UITableViewController to the storyboard.
Embed the UITableViewController in a NavigationController.
Set a segue from the tab bar button to the new NavigationController.
2)
To fully set up the prototype cell you showed you will need to create a new class which subclasses UITableViewCell and then set IBOutlets for all the labels etc.
I am trying to mimic UISplitViewController with container.
I have two contains, the left one (MasterView) and the right one (DetailedView). Inside each container, it is UIViewController.
The left one has a tableview inside it. The right one has a UICollectionView inside it.
I want to use left side tableviewcell segue to the right side collectionview (replace segue), so I click different tableviewcell, the content of the collectionview will change. But it does not work. The error message is as below.
Could not find a split view controller ancestor for MasterViewController
I googled around, it seems the "replace segue" only works for splitview, is it correct?
But both my MasterViewController and Detailedview controllers are UIViewController.
How can I use "replace segue" from a tableviewcell inside Masterview to the collectionview inside the Detailed view?
Thanks.