Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- XYZVIEWCONTROLLER.m:
- //
- // XYZViewController.h
- // SADD
- //
- // Created by Matthew on 5/30/13.
- // Copyright (c) 2013 VSN. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- @interface XYZViewController : UIViewController
- -(IBAction)showEvents;
- @end
- XYZVIEWCONTROLLER.m
- //
- // XYZViewController.m
- // SADD
- //
- // Created by Matthew on 5/30/13.
- // Copyright (c) 2013 VSN. All rights reserved.
- //
- #import "XYZViewController.h"
- #import "EVENTSViewController.h"
- @interface XYZViewController ()
- @end
- @implementation XYZViewController
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (IBAction)showEvents
- {
- EVENTSViewController *second = [[EVENTSViewController alloc] initWithNibName:@"EVENTSViewController" bundle:nil];
- [self presentViewController:second animated:YES completion:nil];
- }
- @end
- EVENTSVIEWCONTROLLER.h:
- //
- // EVENTSViewController.h
- // SADD
- //
- // Created by Matthew on 5/30/13.
- // Copyright (c) 2013 VSN. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #import "SimpleTableCell.h"
- @interface EVENTSViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
- -(IBAction)back;
- @end
- EVENTSVIEWCONTROLLER.m:
- //
- // EVENTSViewController.m
- // SADD
- //
- // Created by Matthew on 5/30/13.
- // Copyright (c) 2013 VSN. All rights reserved.
- //
- #import "EVENTSViewController.h"
- #import "SimpleTableCell.h"
- @interface EVENTSViewController ()
- @end
- @implementation EVENTSViewController
- {
- NSArray *tableData;
- NSArray *descriptionData;
- }
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- // Custom initialization
- }
- return self;
- }
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- tableData = [NSArray arrayWithObjects:@"Egg Benedict", @"Mushroom Risotto", @"Full Breakfast", @"Hamburger", @"Ham and Egg Sandwich", @"Creme Brelee", @"White Chocolate Donut", @"Starbucks Coffee", @"Vegetable Curry", @"Instant Noodle with Egg", @"Noodle with BBQ Pork", @"Japanese Noodle with Pork", @"Green Tea", @"Thai Shrimp Cake", @"Angry Birds Cake", @"Ham and Cheese Panini", nil];
- descriptionData = [NSArray arrayWithObjects:@"Egg Benedict", @"Mushroom Risotto", @"Full Breakfast", @"Hamburger", @"Ham and Egg Sandwich", @"Creme Brelee", @"White Chocolate Donut", @"Starbucks Coffee", @"Vegetable Curry", @"Instant Noodle with Egg", @"Noodle with BBQ Pork", @"Japanese Noodle with Pork", @"Green Tea", @"Thai Shrimp Cake", @"Angry Birds Cake", @"Ham and Cheese Panini", nil];
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (IBAction)back
- {
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [tableData count];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *simpleTableIdentifier = @"SimpleTableCell";
- SimpleTableCell *cell = (SimpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
- if (cell == nil)
- {
- NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
- cell = [nib objectAtIndex:0];
- }
- cell.nameLabel.text = [tableData objectAtIndex:indexPath.row];
- cell.descriptionLabel.text = [descriptionData objectAtIndex:indexPath.row];
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 78;
- }
- @end
- SIMPLETABLECELL.h:
- //
- // SimpleTableCell.h
- // SADD
- //
- // Created by Matthew on 5/30/13.
- // Copyright (c) 2013 VSN. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- @interface SimpleTableCell : UITableViewCell
- @property (nonatomic, weak) IBOutlet UILabel *nameLabel;
- @property (nonatomic, weak) IBOutlet UILabel *descriptionLabel;
- @end
- SIMPLETABLECELL.m
- //
- // SimpleTableCell.m
- // SADD
- //
- // Created by Matthew on 5/30/13.
- // Copyright (c) 2013 VSN. All rights reserved.
- //
- #import "SimpleTableCell.h"
- @implementation SimpleTableCell
- @synthesize nameLabel = _nameLabel;
- @synthesize descriptionLabel = _descriptionLabel;
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- // Initialization code
- }
- return self;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated
- {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement