You're not using specific model objects, so your current code is fine.
However, a more robust way of working would be to define an object which represents the model object you're representing in each cell. This would have properties representing the name, section and legislation. Your tableview would then configure each cell based on the object, and the datasource hold a single array instead of multiple ones for each property.
When you pushed to a detail view controller, you'd just pass this model object across.
This approach has several advantages:
- Less code
- More extensible (if you added another property to your model object, you wouldn't need to add yet another array, and property on your detail view controller)
- Clearer to understand
Making model objects is very simple, particularly now there's autocompletion of properties. Just make a NSObject subclass, and declare your properties in the header:
@property(nonatomic,copy) NSString *title;
@property(nonatomic,copy) NSString *name;
@property(nonatomic,copy) NSString *legislation;
That's all there is to it. The compiler will auto-synthesise these properties for you.