-3

Will apple approve my app if I fake a table view with buttons? I am still learning and haven´t learnt yet how to achieve great table views. But I´m a good designer and combining buttons and a scroll view I can obtain the same effect as if it was a Table View.

The thing is: I want to go to different Detail Views depending on the cell you select in a Table View. I don´t know how to do it. I have searched and searched but I can´t find how to do it.

Therefore, for me is much easier to "fake" a table view with buttons and use storyboard to take you to different Views. I know it is not the most efficient solution, but it is an effective one.

If I do that, will my app be rejected by Apple? And also, is there a limit on how many different views I can make in storyboard?

I mean, could I create 250 different views with storyboard and move from one to other by segues?

Thank you all in advance for your answers.

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
  • 2
    "Will Apple approve my app if..." questions necessarily call for speculation and really aren't constructive. Regardless of whether they will or won't, I think you'd be much better off learning to use tables properly. After all, tables ARE scroll views, so faking it will just entail reinventing stuff that already works well. Why not ask for help if you're stuck understanding how to use them? – Caleb Feb 02 '12 at 23:52
  • Sorry for that. I will take that into account. I have just started and I have seen lots of tutorials of table views... But most of them take you to the same Detail View. I haven´t found an explanation to take you to different Detail Views depending on your choice. I was just being creative and was wondering if that could be a possible solution. Nothing more. I wasn´t speculating. I was asking if some knew if it is accepted or not. I like to ask when I don´t know something. I guess that´s why this forum exists. – user1184051 Feb 03 '12 at 00:22
  • @user1184051 It's not that you were speculating, it's that it's impossible to answer the question without essentially guessing. Per the [FAQ](http://stackoverflow.com/faq) questions should be answerable, but questions about what Apple will do really aren't. – Caleb Feb 03 '12 at 06:06

2 Answers2

1

I'd recommend going the tableView way, since thats the easy and standard way.

I dont think Apple would like the other approach, since thats what table views were made for, but it may get approved anyways.

If you know the basics on how to create a UITableView and how to implement the UITableViewDelegate and UITableViewDatasource, all you have to do is to implement the tableView:didSelectRowAtIndexPath: method from the UITableViewDelegate.

An implementation for this should look like:

-(void) tableView:(UITableView *) tableView 
    didSelectRowAtIndexPath: (NSIndexPath *) indexPath
{
   [tableView deselectRowAtIndexPath:indexPath
                animated:YES];
   NSUInteger rowIndex= [indexPath row];//this is the index in the tablevie of the tapped row

   //do stuff with the rowIndex, instantiate another view, etc
}

Hope this helps

codingcthulhu
  • 253
  • 2
  • 9
  • Great! Thank you very much!! I will definitely try it this way. Only one more question. Lets say if row index = 0 I want to go to view controller 1 if row index = 1 to vc 2 if row index = 2 to vc 1 again So, how can I tell vc1 to show the appropriate data? Lets say a label with the name of an album. If you push the artist a in row 0 i want vc1 label to show "Artist A". But if I push the artist c in row 3 I want vc1 label to show "Artist C"... How can I make that? I really appreciate your help. Thank you very much!! – user1184051 Feb 03 '12 at 00:17
  • You are welcome. This may lead to a large explanation, take a look at http://stackoverflow.com/questions/2363777/iphone-how-to-pass-data-between-several-viewcontrollers-in-a-tabbar-app , this may give you an idea of what you are trying to achieve – codingcthulhu Feb 03 '12 at 00:27
  • My bad, this is actually the approach I'd recommend you to take a look at http://stackoverflow.com/questions/453406/passing-variables-to-different-view-controllers – codingcthulhu Feb 03 '12 at 00:30
0

I want to go to different Detail Views depending on the cell you select in a Table View. I don´t know how to do it.

Your table delegate's -tableView:didSelectRowAtIndexPath: method will be called whenever the user taps on a cell. You can implement that method to look at the index path (that is, the section and row) and take action based on what you find. If you have ten cells that all should lead to different view controllers, you can switch on the row and have a different case for each one that loads the appropriate view controller. Or, you can use the index path to figure out what data is displayed in the cell, and take action based on that.

Caleb
  • 124,013
  • 19
  • 183
  • 272