I wish I could create custom view with tableview in iOS - ios

I'm having trouble creating a view hierarchy. I'm developing a custom UIView to display a list.
Here is what I would like to achieve:
Instead, I'm getting the following weird output:
I want the OK button to be at a specific X,Y position.
**My Current View Hierarchy is like **
UIView
ContainerView-(CustomView to show tableview with UIButton)
ContainerView contains UITableView,UILabel,UIButton (with titled OK )
Sorry for my English :)

Related

Table View is taking interaction when a view of same bounds is added above that in OS X

My app contains a Table View which is scrolling and taking events properly. But after that I have to show a custom pop up to screen for that I have added a full view over the Table View. But after adding the view over Table View, Table view is still scrolling and taking events.
Please help if anyone have knowledge about that...
Thanks
The best way to achieve this is to add a blur view into your nib file first. This is better approach as the user is made aware of the current enabled object.
Once you add the blur view over the tableView you are showing, add your custom pop-over. This would maintain a clear demarcation between the two views and you would be able to achieve the functionality you want as the touches won't flow to your tableView.
Follow below steps may work:
Add overlay view on screen to show data on top of table view
make TableView Disbaled as soon as u add view on it.

iOS Different Views for Table View Cell items

I just started iOS development last week and I am creating a Table View based application. I having trouble understanding how to use storyboard.
I want each Table Cell to open a different ViewController.
Currently it is setup like this:
Then in the Component View Controller I use if/else statements to determine what content to load. The problem occurs when one of the views needed a TabBar.
How do I assign different View Controllers to each individual cell, rather than one "template" view and forced to add everything dynamically.
First off, I will say that it probably isn't the best idea to assign an individual view per cell. However, if it is what you wish to do, then so be it.
What you would do is create a segue from the table view to the new view by clicking on the table view icon and dragging a segue like so:
2.You would give that segue an identifier like "embedTweetsSegue" or something.
You can then check for the cell being touched and perform the segue programmatically using:
performSegueWithIdentifier("embedTweetsSegue", sender: self)

How to create a separate view in Storyboard to be included programmatically in UITableView?

I have a UIViewController with a UITableView that is fed with data from the local database. When the user first launches the app (after installing) the table view is empty and I display a UIView in the middle of the table view that contains a UIImage, a UILabel and a UIButton (a call to action).
The first version of this view I built programmatically, which was no good to me because every time I tweaked something I had to build the app again. Then I switched to the storyboard but had to drag a UIView to the middle of my tableView. It is working now but I don't like the way it is, I can't edit my table view cells without having to move the UIView out of the table view.
I'd like to have a way to build this view entirely separated from my tableView (or even from my view controller in question) and then reference it in the viewDidLoad call of my view controller.
Unfortunately Xcode does not allow us to drag views directly to the storyboard so I'm pretty lost here.
Please tell me if I haven't been clear enough. I appreciate any help you could give me.
UPDATE: It'd be particularly awesome to me if I could also create a custom Swift class for this view of mine and reference it in the storyboard. And then in my viewDidLoad I could simply instantiate my custom view.
Thanks in advance.
Create a XIB file in which you can drag a view (without a view controller).
In your code you can load the XIB using NSBundle.mainBundle().loadNibNamed("MyXibName", owner:self, options:nil).
In the XIB file you can give the UIView a custom class (like you can do with view controllers in storyboard).
You then of course have to retrieve the view from the array returned by loadNibNamed and cast it to your custom class.

Modify or delete table view cell in master-detail ipad app

I am developing a simple master-detail ipad app. Using xcode template for master-detail app when "Edit" navigation item is pressed in table view cell red circle appears which allows to delete selected cell.
In my app I would like to have the following: when edit button is pressed each cell can be deleted or modified (by performing segue to detail view). In other words with the red circle I would like to have another "icon" to modify the contents of that cell. Is it possible to perform this and how can be it done?
You can do this kind of stuff in multiple ways.
First is that you assign a custom gesture like swipe on the cell using the UIGestureRecognizer with custom selector that will called each time when the cell is swiped.
You can then display the buttons that are initially hidden from User.
Look into the following post to understand it better - How To Make A Swipeable Table View Cell With Actions – Without Going Nuts With Scroll Views
You could always instead of using the default Edit button, implement a swipe feature that allows the user to swipe the cell to view more options. This link provides a tutorial walkthrough on how to implement this functionality.
Also, this StackOverflow post might help as well if this is the direction you choose to take.

UIButton inside a UIScrollView

I would like to use a scroll view inside my app.I will explain the situation:
Mine is a recipe app.I would like to show all the recipe images inside a scroll view and when i click an image inside the scroll view ,the corresponding ingredients and preparations has to be shown .I saw many tutorials using image view inside the uiscrollview,thought of replacing image view with button.But all those tutorials are so complicated .Can any one refer me a simple example.
This my apps seccond page.when i click a particular recipe in first page its image and ingredients and preparation is shown.But i would like to show all the images in uiscrollview,and when i click a particular image,corresponding ingredients and preparations has to be shown
From my point of view I think that if you would use a UITableView or a UICollectionView (or the corespondent controllers: UITableViewController and UICollectionViewController) you would achieve grater results than trying to add buttons with images inside a scroll view.
UITableView Tutorial and UICollectionView Tutorial
Also you can go and watch the Apple's WWDC videos
I hope this is helpful for you,
Cheeers
Place UIscrollview In View Xib, then add UIButtons Inside UIScrollview , set buttons actions by hooking action type touch up inside in button pressed add subview on UIView and Show details of Recipe.[self.view addSubView:RecipeDetailView]; here recipe detail view subview where you load reciepe info on button pressed.

Resources