How to add multiple rows of buttons? - ios

I am creating an app that would have many categories at the top for filtering (as in I would have items with tags, and I would want to filter items by their tags). Originally I was using scope buttons but that is not user-friendly/visually appealing for many categories. Do you have any suggestions, advice, or existing projects that use a different UI? Any help would be greatly appreciated!

You can use scroll view horizontally to show your cat1, cat2, cat3, etc...
main view -> scroll view -> buttons for cat1, cat2, etc....
You can add buttons at run time and set a action.
There are many open source horizontal category bars are available, please search on Google.
Hope this helps.

A UICollectionView is probably the way to go. You can have lots of customization in the presentation, including size and flow. For tagging you could have a custom UIView that renders as a tag and exists within the Collection.
Often people use them for image collections, but you can collect most anything that can be rendered as a UIView subclass.

Related

Best way to implement multiple UITableViews

I am working on a project where users can upload the names of up to 10 songs. Everything works, I just need to display the “posts” when they are clicked. This will look similar to a post on other social network sites:
Username
Date of post
(Optional note - can be multiple lines, so no fixed height
Song 1
Song 2
Song 3
...
X likes
Username
Date of comment
Comment
So I basically have a UITableView to display the song and relevant information, such as the artist, album, song duration etc in separate cells. I also want to display the comments in a UITableView.
So, my question: should I add a UIScrollView and add all elements separately (e.g. the information on top as a regular UiView), because nesting UITableViews in a UIScrollView is not recommended? I have also thought about implementing the top and bottom views as a UITableViewHeader and UITableViewFooter, but then I am afraid for the dynamic height of both views.
Any suggestions on what might be the best approach to accomplish this?
I've got a screen where I have two UITableViews side by side - it's a quantity picker (count and unit type). Basically what I have is a "parent" view controller with 2 container view controllers. Inside each container there's a table view controller with the table inside. I can route all my table logic back up to the parent controller that way and keep all that in one place. I've done it in a storyboard using autolayout to simplify things, but it could be done just as easily in code. Not sure if it's the 'best' way to do it, but it works great!

Best practice add multiple object at one page on storyboard

I am wondering what is the best practice for creating a page in storyboard that consist of multiple object (It can be imageView, View, label, etc). Look at this image, I feel ridiculous adding new object under the bottom view that is outside the page view.
I know a little how to arrange view with relativeLayout etc in Android. But how can I arrange this page with storyboard and autolayout? I want to arrange a page that consist of multiple object with different size. This maybe a stupid question, but I mean it a lot for me as a newbie developer. Thank you.
Its hard to say without knowing more about what you are trying to do.
It looks to me like it might be a good candidate for using a UITableView. You'd create a table view and add cells for each of the items that you want.
You could also create a scroll view and install the items on the scroll view, either through custom code, or with AutoLayout if there are a fixed number of items.
You could also use a UICollectionView if you need a layout other than a vertical scrolling list of items.
Edit your question with more details on what you're trying to do if you want more specific help.

Best practice to have multiple tableviews in a single view controller

This question maybe already asked in stackoverflow. But, I did not get any clear idea to my scenario.
I have a viewcontroller (Say, MyViewController).
I have a scrollview(Say, MyScrollView) and I have N number of views (Say MyView1, MyView2, ...) in it.
Those views can be scrolled horizontally. Refer the below image for more clarification.
This image was taken from here.
So, the red area is the scroll view that holds multiple views which are yellow color.
Scenario:
I want to call API's for each view, when the API calling and parsing data occurs, I need to show some loading activity indicator in the views. After successful parsing, I need to update corresponding view with UITableView.
Questions:
In my case, the number of views may vary from 3 to 6. Should I maintain 6 separate UITableViews and UIActivityIndicator's?
I tried with three pointers like left, middle & right to hold reference of tableview and activity indicator. But the problem is, before the first three pages are loading, if the user goes to the fourth view, this system will collapse with so many conditions.
Suggestions needed. Confused!!
I think you have to use UIPageViewController with UITableView. it will solve your problem.

Display long text in multiple UITextView

I need to display articles with pictures or videos maybe later. I need to display this in multiple pages. User and swipe up and down to change page. The pages need to slide out and in. What are the good ways to do this? I did some research and have some thoughts with questions.
UITextview. Using one layout manager for each UITextview, it can decide how to separate the article into different pages. Then I need to put UITextview to different views. Add all the views to controller and slide in and out. Question with this approach: how do I know how many views do I need?
UIScrollView. How can it slide in and out?
Thanks,
Lee
I would prefer UIScrollView with Paging.
Here are a few examples
Example 1
Example 2

iphone/ipad how to handle lots of input fields?

I'm writing a app that contains quite a bit of input fields for collecting data.
and im wondering what are some good methods to display these kind of input fields, if there are too many to fit on a screen? so something like the add contact screen... where u can scroll down and there are fields there
my initial idea is to put them in a scroll view and then i can scroll through them, is there a tutorial to do this? it seems like the scroll view is more for dynamically displaying data like a text view, and not for static forms like i was describing.
if anyone has any different methods for doing this please post.
UITableview will match perfectly for what you need.
My friend wrote this which is a container view that automatically helps with moving fields out of the way of the keyboard - It will certainly save you some time if you don't want to use a UITableView:
https://github.com/mackross/GTKeyboardHelper
The other way as H2CO3 suggested is to use a UITableView. If it is a UITableViewController, then you get the moving out of the keyboards way automatically. You could build custom table view cells that are styled to have a prompt and a UITextField for input. You can also set the selectionStyle to UITableViewCellSelectionStyleNone to prevent these cells from highlighting when selected.
I think the third way is to do this with a UINavigationController (or a UIPageControl) and build a kind of wizard, where you go through various pages of related data. This might be the neatest way depending on how many fields you have and if you can group data into common sets (e.g. personal information, work information etc)
I had the same problem and found GTKeyboardHelper to be an easy way out.
After drag and drop the framework in your project, include the header file.
Download and open the example project, then drag the "Keyboard Helper" object from the objects section in the xib to the objects section in your project's interface builder.
Drag and drop all your views to be children of the "Keyboard Helper".

Resources