Hi i am trying to make a tableview with mailbox style panning http://www.mailboxapp.com/ for that i am using this library https://github.com/gloubibou/HHPanningTableViewCell and it is working fine, i swipe the cell and it moves just fine, the problem is that i want to trigger a custom action when i swipe the cell and i have only been able to do it when it is open and then i touch it.
This is the code where the action is happening
#import "TableViewController.h"
#import "HHPanningTableViewCell.h"
#interface TableViewController ()
#property (nonatomic, retain) NSArray *rowTitles;
#end
#implementation TableViewController
#pragma mark -
#pragma mark Initialization
- (id)init
{
self = [super initWithNibName:#"TableViewController" bundle:nil];
if (self != nil) {
self.rowTitles = [NSArray arrayWithObjects:#"Pan direction: None", #"Pan direction: Right", #"Pan direction: Left", #"Pan direction: Both", #"Custom trigger", nil];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
#pragma mark -
#pragma mark Accessors
#synthesize rowTitles = _rowTitles;
#pragma mark -
#pragma mark Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
#pragma mark -
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.rowTitles count] * 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
HHPanningTableViewCell *cell = (HHPanningTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSInteger directionMask = indexPath.row % 5;
if (cell == nil) {
cell = [[HHPanningTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
UIView *drawerView = [[UIView alloc] initWithFrame:cell.frame];
// dark_dotted.png obtained from http://subtlepatterns.com/dark-dot/
// Made by Tsvetelin Nikolov http://dribbble.com/bscsystem
drawerView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"dark_dotted"]];
cell.drawerView = drawerView;
}
if (directionMask < 3) {
cell.directionMask = directionMask;
}
else {
cell.directionMask = HHPanningTableViewCellDirectionLeft + HHPanningTableViewCellDirectionRight;
if (directionMask == 4) {
cell.delegate = self;
}
}
cell.textLabel.text = [self.rowTitles objectAtIndex:directionMask];
return cell;
}
- (void)gestureRecognizerDidPan:(UIPanGestureRecognizer*)gestureRecognizer{
}
#pragma mark -
#pragma mark Table view delegate
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSInteger directionMask = indexPath.row;
NSString *celda = [NSString stringWithFormat:#"%d", directionMask];
[cell isKindOfClass:[HHPanningTableViewCell class]];
HHPanningTableViewCell *panningTableViewCell = (HHPanningTableViewCell*)cell;
if (directionMask == 1) {
if (HHPanningTableViewCellDirectionRight) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Custom Action"
message:#"1"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
}
if ([panningTableViewCell isDrawerRevealed]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Custom Action"
message:#"1"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
}
else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Custom Action"
message:#"2"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
}
}
return indexPath;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
#pragma mark -
#pragma mark HHPanningTableViewCellDelegate
- (void)panningTableViewCellDidTrigger:(HHPanningTableViewCell *)cell inDirection:(HHPanningTableViewCellDirection)direction
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Custom Action"
message:#"You triggered a custom action"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
}
#end
I know i could use a Gesture recognizer to trigger the action but i think the library is already doing that.
in this part i trigger an action knowing exatly the cell, where was it paned to and if the back of the cell is revealed or not, but always by clicking it since it is a select function.
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSInteger directionMask = indexPath.row;
NSString *celda = [NSString stringWithFormat:#"%d", directionMask];
[cell isKindOfClass:[HHPanningTableViewCell class]];
HHPanningTableViewCell *panningTableViewCell = (HHPanningTableViewCell*)cell;
if (directionMask == 1) {
if (HHPanningTableViewCellDirectionRight) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Custom Action"
message:#"1"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
}
if ([panningTableViewCell isDrawerRevealed]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Custom Action"
message:#"1"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
}
else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Custom Action"
message:#"2"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
}
}
return indexPath;
}
and i believe this other part is where the custom action should be trigered but the program never enters this function
- (void)panningTableViewCellDidTrigger:(HHPanningTableViewCell *)cell inDirection:(HHPanningTableViewCellDirection)direction
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Custom Action"
message:#"You triggered a custom action"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
}
I hope i made myself clear and thank you in advance.
Change the delegate method to
- (void)panningTableViewCell:(HHPanningTableViewCell *)cell didTriggerWithDirection:(HHPanningTableViewCellDirection)direction;
For the delegate method to trigger you need to set your controller as delegate for the cell. Currently in your cellForRowAtIndexPath the controller is assigned as delegate only when directionMask is 4. So you either set directionMask to be 4 in your current code (which is returning a value based on the cell position instead) or you set the controller as delegate in every case, as I've done below.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
HHPanningTableViewCell *cell = (HHPanningTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSInteger directionMask = indexPath.row % 5;
if (cell == nil) {
cell = [[HHPanningTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
UIView *drawerView = [[UIView alloc] initWithFrame:cell.frame];
// dark_dotted.png obtained from http://subtlepatterns.com/dark-dot/
// Made by Tsvetelin Nikolov http://dribbble.com/bscsystem
drawerView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"dark_dotted"]];
cell.drawerView = drawerView;
}
if (directionMask < 3) {
cell.directionMask = directionMask;
}
else {
cell.directionMask = HHPanningTableViewCellDirectionLeft + HHPanningTableViewCellDirectionRight;
// previous code
//if (directionMask == 4) {
// cell.delegate = self;
//}
}
cell.delegate = self;
cell.textLabel.text = [self.rowTitles objectAtIndex:directionMask];
return cell;
}
Related
I've been using NSUserDefualts. Whenever I try to save to a NSMutableArray it crashes the app. How would I fix this?
I tried to figure it out online, but it's been bringing up either swift or guides that don't support any of what I searched.
#import "scoutViewViewController.h"
#interface scoutViewViewController ()
#property (weak, nonatomic) IBOutlet UITableView *scoutView;
#end
BOOL check = YES;
#implementation scoutViewViewController
*tableData; // u need this for a standalone/ static one
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
tableData =[[NSUserDefaults standardUserDefaults] objectForKey:#"data_0"];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tableData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = #"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
return cell;
}
//segue select
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:#"show" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:#"show"]) {
}
}
//ediatable tableView
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[tableData removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:#[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[self scoutView];
}
}
- (IBAction)addCell:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Team Name Or Number" message: #"" delegate:self cancelButtonTitle:#"Cancel" otherButtonTitles:#"Ok", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert show];
}
-(void) alertView:(UIAlertView *) alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
//only accept if the user hit ok
// need to implement "UIAlertController" becuase UIAlert is no longer used.
if(buttonIndex == 1){
NSString *temptxtfield = [alertView textFieldAtIndex:0].text;
if(!tableData){
tableData = [[NSMutableArray alloc]init];
}
if([temptxtfield isEqual: #""] || [temptxtfield isEqual: #" "]){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Team Name Or Number" message: #"" delegate:self cancelButtonTitle:#"Cancel" otherButtonTitles:#"Ok", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
check = NO; //check, nothing to do wiht the implemtaiont
}else{
check = YES;//check, nothing to do wiht the implemtaiont
}
if(check == YES){//check, nothing to do wiht the implemtaiont
[tableData insertObject:temptxtfield atIndex:0];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.scoutView insertRowsAtIndexPaths:#[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
check= NO;//check, nothing to do wiht the implemtaiont
}//check, nothing to do wiht the implemtaiont
//check is to prevent nothing to be placed into the tabel, nothing to do with how the data is inserted into the table
}
}
- (IBAction)saveTable:(id)sender {
[[NSUserDefaults standardUserDefaults] setObject: tableData forKey:#"data_0"];
}
-(void)save2{
}
#end
It gives me a SIGBART error when it crashes, I tried figuring out with break points but it's being a pain.
ended up figuring it out, pretty simple now that I think of it and I feel pretty dumb not knowing it beofore lol...
tableData = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:#"tabelSave"]];
Hi I am trying to trigger events for UIsegment control inside the collection view.
here is my code.
CollectionViewCell.h
#property (strong, nonatomic) IBOutlet UISegmentedControl *mySegmentedControl;
ViewController.m
{
NSInteger selectedSegment;
}
- (UIView *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
cell.mySegmentedControl.tag = indexPath.row;
selectedSegment = cell.mySegmentedControl.selectedSegmentIndex;
[cell.mySegmentedControl addTarget:self action:#selector(segmentValueChanged:) forControlEvents:UIControlEventValueChanged];
}
- (void) segmentValueChanged: (UISwitch *) sender {
//NSInteger index = sender.tag;
if(selectedSegment == 0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"!Alert"
message:#"Do you think this property is not exists?"
delegate:self
cancelButtonTitle:#"Cancel"
otherButtonTitles:#"Yes", nil];
[alert show];
}
else
{
//your code
}
}
The above code not works for me.Any help will be appreciated.
is not UISwitch it is UISegmentedControl do like
- (void) segmentValueChanged: (UISegmentedControl *) sender {
//NSInteger index = sender.tag;
if(sender.selectedSegmentIndex == 0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"!Alert"
message:#"Do you think this property is not exists?"
delegate:self
cancelButtonTitle:#"Cancel"
otherButtonTitles:#"Yes", nil];
[alert show];
}
else
{
//your code
}
}
I added a Searchbar and Search Display Controller to my iPad app that use localSearch. I believe I implemented the delegates correctly. The search works fine and displays the results but the issues is that these results start in the second cell. The first cell in the popup display being empty. I double checked to see if the map items count and contents were correct and they were.
The code:
- (void) searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
if (![self connected]) {
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(#"Cannot Connect",nil)
message:NSLocalizedString(#"Please make sure you are connected to the internet and try again.",nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(#"OK",nil) otherButtonTitles:nil] show];
}
else if ([mainToolbar isHidden])
{
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(#"Search Unavailable",nil)
message:NSLocalizedString(#"Please make sure you aren't drawing an AOI or using a tool and then try again.",nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(#"OK",nil) otherButtonTitles:nil] show];
}
else {
// Cancel any previous searches.
[localSearch cancel];
// Perform a new search.
MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc] init];
request.naturalLanguageQuery = self.searchBar.text;
request.region = self.mapView.region;
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
localSearch = [[MKLocalSearch alloc] initWithRequest:request];
[localSearch startWithCompletionHandler: ^(MKLocalSearchResponse *response, NSError *error){
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
if ([response.mapItems count] == 0)
{
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(#"No Results",nil)
message:nil
delegate:nil
cancelButtonTitle:NSLocalizedString(#"OK",nil) otherButtonTitles:nil] show];
return;
}
if (error != nil)
{
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(#"Map Error",nil)
message:NSLocalizedString(#"Sorry.", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(#"OK",nil) otherButtonTitles:nil] show];
return;
}
results = response;
[self.searchDisplayController.searchResultsTableView reloadData];
}
];
}
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [results.mapItems count];
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *IDENTIFIER = #"SearchResultsCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:IDENTIFIER];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:IDENTIFIER];
}
MKMapItem *item = results.mapItems[indexPath.row];
cell.textLabel.text = item.name;
cell.detailTextLabel.text = item.placemark.addressDictionary[#"Street"];
return cell;
}
Here is a screenshot of the issue.
The first row contains the table header.
I have a alert view with a textfield so whenever someone types in it and pressed the save button it puts in the table view. when you click on the cell after being saved it takes you to a different view. Now when you go back to the home page, the cells disappear. I have tried multiple ways of figuring it out, yet still haven't been able to. Do I need to add a plist so every time I add a cell it gets saved to the plist and if so where would i start?
This code is in my table view controller
- (IBAction)add:(id)sender {
NSLog(#"%#",tableData);
UIAlertView* alert=[[UIAlertView alloc] initWithTitle:#"My Favs" message:#"Hello" delegate:self cancelButtonTitle:#"Cancel" otherButtonTitles:#"Save", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.enablesReturnKeyAutomatically = YES;
alertTextField.placeholder = #"example";
[alert show];
return;
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
NSLog(#"%#",tableData);
//Only do the following action if the user hits the ok button
if (buttonIndex == 1){
NSString *tapTextField = [alertView textFieldAtIndex:0].text;
if (!tableData)
{
tableData = [[NSMutableArray alloc]init];
}
[tableData insertObject:tapTextField atIndex:0];
[myTableView reloadData];
}
}
I think tableData is getting deallocated when you are coming back to the home page. If the tableData is not a huge array you can store it in NSUserDefaults. This way when ever you come back to the table you can always retreat the data. Check out this code. It will store the tableData in the NSUserDefaults every time you add anything to the array. Let me know if this works for you.
#import "ViewController.h"
#interface ViewController () <UIAlertViewDelegate,UITableViewDataSource,UITableViewDelegate>
#property (weak, nonatomic) IBOutlet UITableView *myTableView;
#property (nonatomic,strong) NSMutableArray *tableData;
#end
#implementation ViewController
-(NSMutableArray *)tableData
{
if(!_tableData){
NSMutableArray *data = [[NSUserDefaults standardUserDefaults]objectForKey:#"data"];
if(!data){
_tableData = [[NSMutableArray alloc]init];
}else{
_tableData = [data mutableCopy];
}
}
return _tableData;
}
- (IBAction)add:(UIButton *)sender {
UIAlertView* alert=[[UIAlertView alloc] initWithTitle:#"My Favs" message:#"Hello" delegate:self cancelButtonTitle:#"Cancel" otherButtonTitles:#"Save", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.enablesReturnKeyAutomatically = YES;
alertTextField.placeholder = #"example";
[alert show];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1){
NSString *tapTextField = [alertView textFieldAtIndex:0].text;
[self.tableData insertObject:tapTextField atIndex:0];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:self.tableData forKey:#"data"];
[defaults synchronize];
[self.myTableView reloadData];
}
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return[self.tableData count];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"dataCell" forIndexPath:indexPath];
if(self.tableData.count > 0){
cell.textLabel.text = self.tableData[indexPath.row];
}
return cell;
}
Sorry I'm new to iOS. I intend to make an UITableView inside UIAlertView. Finally i have gotten this tutorial
I have implemented UIAlertTableView class this way
UIAlertTableView *alert = [[UIAlertTableView alloc] initWithTitle:#"Choose a number"
message:nil
delegate:self
cancelButtonTitle:#"Cancel"
otherButtonTitles:nil, nil];
alert.tableDelegate = self;
alert.dataSource = self;
alert.tableHeight = 120;
[alert show];
However after testing, i got the UIAlert displayed a blank list, with no items appear inside. Previously i have an NSMUtableArray that i want to use as data source. From the tutorial above, seems that assigning data source is done using alert.dataSource = self. Yet i'm still wondering how to use my NSMutableArray as the data source and how it relates to alert.dataSource?
I'll suggest you need to create a new file as your alertView's table datasource and delegate.
Implement the:
#interface MyTableSource: UIViewController <UITableViewDataSource, UITableViewDelegate>
#end
#implementation MyTableSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 7;
}
- (UITableViewCell *)tableView:(UITableView *)tableViews cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"MyIdentifier";
UITableViewCell *cell = [tableViews dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = #"M";
return cell;
}
#end
Create the alert like:
UIAlertTableView *alert = [[UIAlertTableView alloc] initWithTitle:#"Choose a number"
message:nil
delegate:self
cancelButtonTitle:#"Cancel"
otherButtonTitles:nil, nil];
MyTableSource *data = [[MyTableSource alloc] init];
alert.tableDelegate = data;
alert.dataSource = data;
alert.tableHeight = 120;
[alert show];
Note:
I implemented that alertView for testing, there are alot of issues.
You need to call:
[self layoutAnimated:YES]; instead of [self setNeedsLayout]; in the alertView class.
You have told UIAlertView your class will be acting as its data source but you would also need to override at least the following UITableView data source methods, Here mutableArray refers to the mutable Array you want to use as data source:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [mutableArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
NSString *cellValue = [mutableArray objectAtIndex:indexPath.row];
cell.text = cellValue;
return cell;
}