Reputation: 625
I am writing an image gallery application that has multiple categories in which the user can view photos. On one of the menus, there are three UIButtons that list the categories of photos: 1970s, 1980s, 1990s.
When the user taps on "1970s", it segues into a Table View where there is an array of photos and labels. Each Table cell has its own photo and corresponding label dictating the date and location of the photo. When the user taps on a cell, it leads to a UIImage view and a scroll view where the image can be viewed fullscreen and zoomed/panned. There is also a little popover view on the UIImage view that can be displayed via a button.
The problem I'm having is that the Table view, Image view, and popover view take up three Storyboard "controllers". I want to replicate this table view, fullscreen image view, and popover view across many different categories (UIButtons) I have all over the app. Is there a way to repopulate a Table View depending on which UIButton is pressed?
Thanks for the help! I am in Swift 3 and using Xcode.
Upvotes: 0
Views: 53
Reputation: 1071
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return dataArray.count;
}
- (void) 1970Action{
dataArray = 1970ImagesArray;
[self.tableView reloadData];
}
- (void) 1980Action{
dataArray = 1980ImagesArray;
[self.tableView reloadData];
}
- (void) 1990Action{
dataArray = 1990ImagesArray;
[self.tableView reloadData];
}
Upvotes: 1