Repeat a view in Cocoa application - objective-c

I have the following design:
How should I proceed? Add a NSScrollView with the first element, which contains a couple of NSTextFields and an NSImage and then repeat in the code? What type of repeater should I use? And... is NSScrollView able to handle this type of design?
Is it possible to use NSTableView?
Thank you!

I would probably have a custom NSView class that contains the date labels on the left, a NSImage that toggles between two states (selected or not) and the request label on the right. You can lay it out either in code or in a .nib and instantiate it that way respectively.
When you create the superview create four of the new subclasses and put them in the appropriate places.
Only use scroll view if you think that you'll have so many options that you will need to scroll.

Related

Add custom view in UICollectionView

I tried lot but not find any way to add custom view in UICollectionView before starting on each UICollectionViewCell. I have attached screenshot, what i want.
I have used UICollectionView to display object section vise and indicate arrow which view custom view i want to add.
Help appreciate..
Thanks in Advance.
.
You will have to write your own UICollectionViewLayout and give it a decoration view (or possibly, if this view is tied to the layout of the section data, some new kind of supplementary view).

How to combine several iOS controls in one entity (control)?

I want to implement custom search and have one trouble. I need to combine UIButton, SearchBar in one control in order I can refer it by pointer.Then i will dynamically add more UIbuttons to that combined control.And the most important I want to manipulate this combined control as one program entity. For instance,CombinedControl* control;
So what the common way to implement this? Or may be I can emulate this?Thanks in advance!
If you're looking to combine multiple controls into a single unit, the simplest thing to do is just to add them as subviews of a single UIView. You can do this either in Interface Builder (by creating a blank UIView and dropping the other controls on it) or in code (using addSubview:). Then you just have a variable that points to the UIView that you added everything to.
If you want to add behavior to the "combined control", then you should create a subclass of UIView (as H2CO3 suggested above) and add the controls to that view subclass.

Creating a Scrolling Categories Section In a Navigation Controller (XCode)

So I'm curious. I was looking into a way to create a categories selector similar to the one located at the top of this application: http://itunes.apple.com/us/app/xfeed-rss-reader/id313206921?mt=8 ... 06921?mt=8. Would I tackle this using a Toolbar and elongating it to where the user can 'scroll' side to side for categories? Or a ScrollView with a Tabbar in it? I want to do this the 'proper' way per say and I've seen flags raised about a Tabbar being in a ScrollView.
If I were implementing this, I would create it with a UIScrollView containing UIButtons. UITabBars have some nice integration with UIViewControllers and UINavigationControllers, but the benefits quickly drop off when you need more customizable behavior (left to right scrolling, for instance.). I would normally just put them all in a xib and connect the outlets appropriately, unless it was important that they be dynamic.
You mentioned correctness, so an even more "correct" way is to create a UIControl similar to a UISegmentedControl that handles the creation of properly sized labels, deals with touches appropriately, etc. If you are setting categories dynamically you'll want to override sizeThatFits: and call sizeToFit so you can properly size the content area of your scrollview.

The same UI as in Contacts (buttons and a table view in the same place)

Please go to your Contacts app, and choose one of your contacts.
You'll see that the view has labels, buttons and a table view all in the same view. And you can also scroll it around.
I want to set up the same kind of UI.
How would I organize things in interface builder to accomplish this? I would imagine I’d have to create a regular UIViewController subclass, and create a XIB file with a scroll view, which in turn contains the buttons and table view? I tried, but it doesn't give me the desired effect. For example, the view refuses to “bounce” upon scrolling.
You have to create a UITableViewController and create the Table you want.
The buttons are costum Table cells in the UITableView with round rect buttons in it. They have selectors to call methods.
Edit: Wrong answer, poster wants something different, but I'll let the answer stand because people might land here while searching.
What you probably want is the ABPeoplePickerNavigationController. Apple has sample code that demonstrates how to use it.
It might be using tableview or might be just a UIVIew with ScrollView and labels+buttons. You approach is right and it'll bounce if your view size is larger than your screen size

Best way to have UITableView within another table?

I have a grouped UITableView in class A and if you select a row in section 0, I want it to open up to another UITableView. In the first view, I have a lot of other methods and buttons and custom designed stuff, so I don't want to create another XIB for the other table view since I'll have to copy over all the methods and custom designed stuff. I was thinking creating another XIB, but subclassing the class under the original class A this way I can use the methods of class A without having to redefine them again in the new class. But I'm having problems with this. Is there a better way? Can I have two table views in one XIB, and just hide one till the other is called up? But that seems a little messy..
If you simply try subclassing the existing viewcontroller it will have the same info for the selected row, hence it would have to grow exponentially in order to make display the right UITableView.
If your concern is redefining methods, then simply create a class that will hold those particular methods and include it in the UITableViewControllers that will be using them, that way you will only define it once. This way you can simply create a new UITableViewController and push it into a navigation controller everytime you select a given cell.
As an alternative of showing all options within one UITableView you can try the following: you can probably try adding a UIScrollView inside the UITableViewCell. I would make it scroll horizontally while keeping the UITableView scroll vertically.