0
votes

I have a slide menu from the right that I would like to customize to have icons rather than text labels.

I have SlideNavigationController.m and SlideNavigationController.h

In MenuViewController.h I have:

#import <UIKit/UIKit.h>
#import "SlideNavigationController.h"

@interface MenuViewController : UIViewController <UITableViewDelegate>

@property (nonatomic, strong) NSString *cellIdentifier;

@end

In MenuViewController.m I have:

#import "MenuViewController.h"

@implementation MenuViewController
@synthesize cellIdentifier;



#pragma mark - UITableView Delegate & Datasrouce -

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection (NSInteger)section
{
return 3;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier];


switch (indexPath.row)
{
    case 0:
        cell.imageView.image = [UIImage imageNamed:@"Maps-icon.png"]; 
        break;

    case 1:
        cell.textLabel.text = @"Yellow";
        break;

    case 2:
        cell.textLabel.text = @"Orange";
        break;



}

return cell;
}

For each case (for example, case 0: cell.imageView.image = [UIImage imageNamed:@"Maps-icon.png"]; I want to place image on the far right side of the cell since this is what displays on the slide animation. How do I change the position of the image?

Thanks in advance.

1
i faced the same problem; can you tell me how you solve this; thanks - Sonic

1 Answers

0
votes

You are simply looking to customize a UITableViewCell. There are loads of tutorials all over the internet on how to do this.

http://mobile.tutsplus.com/tutorials/iphone/customizing-uitableview-cell/ https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TableView_iPhone/TableViewCells/TableViewCells.html

Also, you are probably better off using an array to hold data about your table view cells rather than having a switch statement.