Table View Trouble

Discussion in 'iOS Development' started by maxk96, Jun 2, 2010.

  1. maxk96

    maxk96 New Member

    Joined:
    Jul 8, 2009
    Messages:
    37
    Likes Received:
    0
    Device:
    2G iPod touch
    Hi, i am trying to implement this into my source code and i am finding it very difficult :
    Code:
    launch:
    if (alertView.title == @"Launch Application WithIdentifier") {
    			[[[SBManagerAppDelegate sharedAppDelegate] userDefaults] setObject:[[alertView textField] text] forKey:@"launchApplicationWithIdentifier"];
    
    			
    			[[UIApplication sharedApplication] launchApplicationWithIdentifier:[[alertView textField] text] suspended:NO];
    		}
    
    uuid:
    
    if (indexPath.row == 0) {
    			cell.textLabel.text = @"uniqueIdentifier";
    			cell.detailTextLabel.text = [[UIDevice currentDevice] uniqueIdentifier];
    		}
    could anyone tell me how i could implement this into my source code here:
    Code:
    - (void)viewDidLoad {
        [super viewDidLoad];
    	
    	tableList = [[NSMutableArray alloc] init];
    	[tableList addObject:@"Open Application With Identifier"];
    	[tableList addObject:@"UUID"];
    	[self setTitle:@"YourInfo"];
    
        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    }
    
    
    /*
    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
    }
    */
    /*
    - (void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
    }
    */
    /*
    - (void)viewWillDisappear:(BOOL)animated {
    	[super viewWillDisappear:animated];
    }
    */
    /*
    - (void)viewDidDisappear:(BOOL)animated {
    	[super viewDidDisappear:animated];
    }
    */
    
    /*
     // Override to allow orientations other than the default portrait orientation.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    	// Return YES for supported orientations.
    	return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
     */
    
    - (void)didReceiveMemoryWarning {
    	// Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];
    	
    	// Release any cached data, images, etc that aren't in use.
    }
    
    - (void)viewDidUnload {
    	// Release anything that can be recreated in viewDidLoad or on demand.
    	// e.g. self.myOutlet = nil;
    }
    
    
    #pragma mark Table view methods
    
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return 1;
    }
    
    
    // Customize the number of rows in the table view.
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        return [tableList count];
    }
    
    
    // Customize the appearance of table view cells.
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        
        static NSString *CellIdentifier = @"Cell";
        
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        }
        
    	[cell setText:[[tableList objectAtIndex:indexPath.row] retain]];
    	[cell setAccessoryType:UITableViewCellAccessoryNone];
    
        return cell;
    }
    
    
    
    
    // Override to support row selection in the table view.
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    }
    
    thanks in advance
  2. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    I'm not sure what exactly you are trying to do...though it looks that first bit of code belongs in the -[tableView:cellForRow...:] method.

    however, you can't use operator == to compare NSString objects—or at least, not the way you might expect. [objc]if (alertView.title == @"Launch Application WithIdentifier")[/objc]
    simply compares the memory address of a string literal with an ivar that has been copied (according to the @property declaration). That comparison is guaranteed to evaluate to be false every time; think about it. To compare two NSString objects, use -[NSString isEqualToString:].

Share This Page