Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)setEditing:(BOOL)flag animated:(BOOL)animated{
- int count = [streams count];
- UITableView *tableView = (UITableView *)self.view;
- NSArray *topIndexPath = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:count inSection:0]];
- if (self.editing == YES)
- {NSLog(@"EDITING");
- [tableView insertRowsAtIndexPaths:topIndexPath withRowAnimation:UITableViewRowAnimationBottom];}
- else{NSLog(@"NOT EDITING");
- [tableView deleteRowsAtIndexPaths:topIndexPath withRowAnimation:UITableViewRowAnimationBottom];}
- }
- - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
- int count = [streams count];
- int row = indexPath.row ;
- if (row == count)
- return UITableViewCellEditingStyleInsert;
- else
- return UITableViewCellEditingStyleDelete;}
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *DeleteMeCellIdentifier = @"AudioCellIdentifier";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
- DeleteMeCellIdentifier];
- if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:DeleteMeCellIdentifier] autorelease];
- }
- int x = indexPath.row;
- if (self.editing == YES)
- {
- if (indexPath.row == [streams count])
- cell.textLabel.text = @"Add Phone Number";
- else
- cell.textLabel.text = [self.streams objectAtIndex:indexPath.row];
- }
- else
- {
- cell.textLabel.text = [self.streams objectAtIndex:indexPath.row];
- }
- return cell;}
- - (void)viewWillDisappear:(BOOL)animated {
- Disc *disc = [Disc sharedDisc];
- [disc.streams insertObject:@"0208" atIndex:0];
- [super viewDidAppear:animated];}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement