Welcome, Guest
Username Password: Remember me

Is it possible to use UI controls separately
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Is it possible to use UI controls separately

Is it possible to use UI controls separately 1 year, 9 months ago #1

Is it possible to use User Interface controls separately apart from Table View.
  • Chauhan
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0

Re: Is it possible to use UI controls separately 1 year, 9 months ago #2

Sure you can.

You start by creating a normal UIViewController with a nib file. Then, from Interface Builder, you can add all the controls you want, including one or more UITableView(s). The UITableView(s) can be anywhere on the view and of any size. Finally, you just need to create an SCTableViewModel for each UITableView you have. The best thing is that Sensible TableView will then handle all the resizing needed when the keyboard appears, and will auto scroll the table to bring selected controls into focus.

Does that answer your question?
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Is it possible to use UI controls separately 1 year, 9 months ago #3

I am learning my way through Sensible TableView, great product so far!
Piggybacking on the same question, my project is Windows based (not Navigation). I tried adding a nav bar by hand and was not successful. I now created a NIB file and with the Interface Builder added only two items (navigation bar, Table View). Please see picture attached.
I am now trying to follow your suggestion and make this happen: “you just need to create an SCTableViewModel for each UITableView you have…”, in my case I just have one.
My .h file looks like:
#import <UIKit/UIKit.h>
#import "SCTableViewModel.h"
@interface NewGame : UIViewController < SCTableViewModelDelegate, SCTableViewCellDelegate > {
SCTableViewModel *tableModel;
}
@end
Two questions:
1) What parameters do I need in the command: tableModel = [SCTableViewModel alloc] initWithTableView:self.tableView withViewController:self];?
2) How do I bound the Navigation Bar that I added through Interface Builder to this tableModel so that I can use the Add, Delete…features that are based on the Nav Bar?
Thanks!
Interface_Builder.png
  • oanzola
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0

Re: Is it possible to use UI controls separately 1 year, 9 months ago #4

Regarding your first question:

1- You need to define an outlet in your view controller's header file and connect it to your tableView in Interface Builder, for example:
 
@interface NewGame : UIViewController < SCTableViewModelDelegate, SCTableViewCellDelegate > {
SCTableViewModel *tableModel;
 
UITableView *tableView;
}
 
@property (nonatomic, retain) IBOutlet UITableView *tableView;
 
@end
 

You will then assign the "tableView" property to SCTableViewModel at initialization time.


As for your second question: The easiest way to achieve what you want in my opinion is to add a navigation controller to your MainWindow.xib and add your view controller to it. This will save you a great amount of headaches.

Hope this helps
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
Time to create page: 0.83 seconds