How can I change the name of item in TableViewController iOS

How can I change the name of item in TableViewController? I want to be able to change the title of an item if I added one. Code:
//  ViewController.m
//  Movie List
//  Created by Damian on 20/02/15.
//  Copyright (c) 2015 Tika Software. All rights reserved.
#import "ViewController.h"
@interface ViewController ()
These outlets to the buttons use a `strong` reference instead of `weak` because we want
to keep the buttons around even if they're not inside a view.
@property (nonatomic, strong) IBOutlet UIBarButtonItem *editButton;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *cancelButton;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *deleteButton;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *addButton;
// A simple array of strings for the data model.
@property (nonatomic, strong) NSMutableArray *dataArray;
@end
#pragma mark -
@implementation ViewController
- (void)viewDidLoad
    [super viewDidLoad];
     This option is also selected in the storyboard. Usually it is better to configure a table view in a xib/storyboard, but we're redundantly configuring this in code to demonstrate how to do that.
    self.tableView.allowsMultipleSelectionDuringEditing = YES;
    // populate the data array with some example objects
    self.dataArray = [NSMutableArray new];
    NSString *itemFormatString = NSLocalizedString(@"Movie %d", @"Format string for item");
    for (unsigned int itemNumber = 1; itemNumber <= 0; itemNumber++)
        NSString *itemName = [NSString stringWithFormat:itemFormatString, itemNumber];
        [self.dataArray addObject:itemName];
    // make our view consistent
    [self updateButtonsToMatchTableState];
#pragma mark - UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    return self.dataArray.count;
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
    // Update the delete button's title based on how many items are selected.
    [self updateDeleteButtonTitle];
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    // Update the delete button's title based on how many items are selected.
    [self updateButtonsToMatchTableState];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    // Configure a cell to show the corresponding string from the array.
    static NSString *kCellID = @"cellID";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
    cell.textLabel.text = [self.dataArray objectAtIndex:indexPath.row];
    return cell;
#pragma mark - Action methods
- (IBAction)editAction:(id)sender
    [self.tableView setEditing:YES animated:YES];
    [self updateButtonsToMatchTableState];
- (IBAction)cancelAction:(id)sender
    [self.tableView setEditing:NO animated:YES];
    [self updateButtonsToMatchTableState];
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
    // The user tapped one of the OK/Cancel buttons.
    if (buttonIndex == 0)
        // Delete what the user selected.
        NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
        BOOL deleteSpecificRows = selectedRows.count > 0;
        if (deleteSpecificRows)
            // Build an NSIndexSet of all the objects to delete, so they can all be removed at once.
            NSMutableIndexSet *indicesOfItemsToDelete = [NSMutableIndexSet new];
            for (NSIndexPath *selectionIndex in selectedRows)
                [indicesOfItemsToDelete addIndex:selectionIndex.row];
            // Delete the objects from our data model.
            [self.dataArray removeObjectsAtIndexes:indicesOfItemsToDelete];
            // Tell the tableView that we deleted the objects
            [self.tableView deleteRowsAtIndexPaths:selectedRows withRowAnimation:UITableViewRowAnimationAutomatic];
        else
            // Delete everything, delete the objects from our data model.
            [self.dataArray removeAllObjects];
            // Tell the tableView that we deleted the objects.
            // Because we are deleting all the rows, just reload the current table section
            [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
        // Exit editing mode after the deletion.
        [self.tableView setEditing:NO animated:YES];
        [self updateButtonsToMatchTableState];
- (IBAction)deleteAction:(id)sender
    // Open a dialog with just an OK button.
    NSString *actionTitle;
    if (([[self.tableView indexPathsForSelectedRows] count] == 1)) {
        actionTitle = NSLocalizedString(@"Are you sure you want to remove this movie?", @"");
    else
        actionTitle = NSLocalizedString(@"Are you sure you want to remove these movies?", @"");
    NSString *cancelTitle = NSLocalizedString(@"Cancel", @"Cancel title for item removal action");
    NSString *okTitle = NSLocalizedString(@"OK", @"OK title for item removal action");
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionTitle
                                                             delegate:self
                                                    cancelButtonTitle:cancelTitle
                                               destructiveButtonTitle:okTitle
                                                    otherButtonTitles:nil];
    actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
    // Show from our table view (pops up in the middle of the table).
    [actionSheet showInView:self.view];
- (IBAction)addAction:(id)sender
    [self.dataArray addObject:@"New Movie"];
    // Tell the tableView about the item that was added.
    NSIndexPath *indexPathOfNewItem = [NSIndexPath indexPathForRowself.dataArray.count - 1) inSection:0];
    [self.tableView insertRowsAtIndexPaths:@[indexPathOfNewItem]
                          withRowAnimation:UITableViewRowAnimationAutomatic];
    // Tell the tableView we have finished adding or removing items.
    [self.tableView endUpdates];
    // Scroll the tableView so the new item is visible
    [self.tableView scrollToRowAtIndexPath:indexPathOfNewItem
                          atScrollPosition:UITableViewScrollPositionBottom
                                  animated:YES];
    // Update the buttons if we need to.
    [self updateButtonsToMatchTableState];
#pragma mark - Updating button state
- (void)updateButtonsToMatchTableState
    if (self.tableView.editing)
        // Show the option to cancel the edit.
        self.navigationItem.rightBarButtonItem = self.cancelButton;
        [self updateDeleteButtonTitle];
        // Show the delete button.
        self.navigationItem.leftBarButtonItem = self.deleteButton;
    else
        // Not in editing mode.
        self.navigationItem.leftBarButtonItem = self.addButton;
        // Show the edit button, but disable the edit button if there's nothing to edit.
        if (self.dataArray.count > 0)
            self.editButton.enabled = YES;
        else
            self.editButton.enabled = NO;
        self.navigationItem.rightBarButtonItem = self.editButton;
- (void)updateDeleteButtonTitle
    // Update the delete button's title, based on how many items are selected
    NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
    BOOL allItemsAreSelected = selectedRows.count == self.dataArray.count;
    BOOL noItemsAreSelected = selectedRows.count == 0;
    if (allItemsAreSelected || noItemsAreSelected)
        self.deleteButton.title = NSLocalizedString(@"Delete All", @"");
    else
        NSString *titleFormatString =
        NSLocalizedString(@"Delete (%d)", @"Title for delete button with placeholder for number");
        self.deleteButton.title = [NSString stringWithFormat:titleFormatString, selectedRows.count];
@end

Hey JB001,
Sounds like you have more going on than just a simple issue with Home Sharing and more dealing with Wi-Fi syncing. Start with the article below and see if that may resolve it.
iTunes 10.5 and later: Troubleshooting iTunes Wi-Fi syncing
http://support.apple.com/kb/TS4062
If it does not work out, then may I suggest contacting Apple for further assistance to walk you through it or just take that time that you were talking about to sort it out.
Contact Apple Support
https://getsupport.apple.com/GetproductgroupList.action
Regards,
-Norm G.

Similar Messages

  • How can I change the name of a Materialized View?

    How can I change the name of a Materialized View?

    Oracle permitted renaming the snapshot in the earlier versions of 8i. However, it does not permit renaming the materialized view in 9i or 10g.
    SQL> rename mymatview to mymatview2;
    rename mymatview to mymatview2
    ERROR at line 1:
    ORA-32318: cannot rename a materialized view
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP and Data Mining options
    SQL> rename mymatview to mymatview2;
    rename mymatview to mymatview2
    ERROR at line 1:
    ORA-32318: cannot rename a materialized view
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.3.0 - Production

  • How can I change the name of a computer I'm getting rid of?

    How can I change the name of the computer to my granddaughter's name? It's now called "My name" G5 iMac. I would also like to delete that computer icon in my Devices on my MacbookPro.

    I guess my reply to these questions in your other topic did not help?
    The name of the computer is in System Preferences Sharing pane.
    If something appears under DEVICES in a Finder window sidebar, you can click hold on it and drag it off the sidebar. If it appears under SHARED, it should no longer appear there once if that iMac is no longer on your local network, or if you turn off its shared services in the Sharing pane.

  • How can I change the name of a PDF in the bookcase

    How can I change the name of a PDF in the bookcase

    Hi,
    It is possible to edit the dictionary, but not recommended.
    It is recommended to use exp/imp to "rename" a schema
    HTH
    Laurent

  • How can I change the name of a Sub Circuit in Multisim

    How can I change the name of a sub-circuit in MultiSim?  
    For example:
    I have a sub-circuit named "Output Channel 1" and its RefDes is SC1.  How do I change its name to 'Input Channel 1'?

    Hi,
    If what you want to change is the RefDes you can do it by right-clicking the sub-circuit and selecting properties. If what you want to change is the name, you can right-click the sub-circuit in the Design Toolbox.

  • How can I change the name of my Mac from old company to my new one, How can I change the name of my Mac from old company to my new one

    How can I change the name of my Mac.  I am using it with a different company now and told want the old company name showing up on emails etc.

    Thanks.  When I rep;y to an email I get this
    SOS Medical <[email protected]>
    I would like to replace the SOS Medical with my company name

  • How can i change the name of my wifi connection on my Airport express?

    The name of my wifi is Réseau de Francois with an accent on the letter E.
    Now, i have many conflict with other electronic components because they do not accept french accent.
    How can if change the name to reseau de francois without an accent on the letter E on my airport express 4th or 5th generation
    thanks

    airport utility in the utilities folder.

  • How can i change the name in my iphone

    How can i change the name in my iphone after i registered it

    If you mean the name you assigned to it, then connect it to your computer, open iTunes, click in the name of the device in the iTunes sidebar, press RETURN to activate the field, change the name, press RETURN again.

  • I used part of my name in my home network.  Now I understand this was stupid security error.  How can i change the name of my home wifi network, airport express?  Thanks.

    I used part of my name in my home network.  Now I understand this was stupid security error.  How can i change the name of my home wifi network, airport express?  Thanks.

    Open Macintosh HD > Applications > Utilities > AirPort Utility
    Click on the picture of the AirPort Express
    Click Edit in the smaller window that appears
    Click the Wireless tab at the top of the next window
    Edit the Wireless Network Name
    Keep it short.....maximum 10-12 characters or so. No blank spaces or punctuation marks in the name
    Click Update at the lower right of the window to save the new setting and wait a full minute for the AirPort to restart

  • How can I change the name of my home folder?

    Just got a new job. Yeah! Taken over former employees' iMac. I made myself Administrator, seem to be the only log in option. But, my home folder is still in the old guys name. How can I change the name on the Home folder without deleting it and loose all the files? CAN'T loose the files?  Help...
    Thanks

    Changing the existing home folder name is complicated. I recommend you NOT do that.
    Instead, create a new User with exactly the home folder name you want, and copy your files over to that new user. Once a few days have gone by trouble-free, and you are certain you have no issues, you can delete the old home folder.
    While on the subject of users, Some users prefer the peace-of-mind of using an "ordinary" user account, rather than an Admin account for daily use. This makes it much harder for anything to "sneak" onto your Mac, as you need to authenticate anything to be installed in system directories.
    To do this, create a new Admin user, log into it, and demote your daily-use account to a non-Admin user. When actively installing stuff, the Admin username and password will be requested.

  • Used ipod how can i change the name on it

    hey guys i bought a used ipod off of a buddy of mine who upgraded to a 80gb like my own the ipod i bought is a 2gb nano how can i change the name of the 2gb ipod

    have a read
    http://docs.info.apple.com/article.html?artnum=60952

  • How can I change the name that my computer/iTunes assigned to my device?

    When I hooked up my new 4s to my desktop, it asked if I wanted to start with a new device.  I answered yes and the device was assigned a default name based on the name of the computer (which wasn't originally mine) so now iTunes recognizes the device as belonging to some dead guy I never met.  Also the same first name as an ex-bf.  Call me weird but this bothers me.  How can I change the name of the device?

    Select the device when it is connected to iTunes. Click in the device name on the summary tab. Enter what you want.
    tt2

  • How can i change the name of my ipod

    bought my son a new ipod so by default i get his old one (which is better than mine) how can i change the name on it - thanks

    Connect your iPod to the computer. Once it shows up in the source list of iTunes (the window on the left where you see "library", "playlists", "podcasts" etc), double click on it and this will highlight it and you can then type a name for it.

  • How can I change the name on my computer

    My Macbook died to much heat.  I am now using my wife's.  She onlu uses an Ipad.  I have a new IPhone and all my messages, eamils are being sent in my wife's name as I synced with the Macbook tht was my wife's.  How can I change the name on the computer?

    Follow these steps : http://www.wikihow.com/Change-the-Name-of-Your-Macbook
    Hopefully the help Cheers!!

  • How can i change the name of my iphone on itunes and register under a new name?

    how can i change the name of my iphone on itunes and register under a new name?

    If you want to rename your device in iTunes, follow this article: iTunes: How to rename your device

Maybe you are looking for

  • Closing Stock of a Material

    If I know the Material Code and Plant then how can I determine the closing stock of that material for a particular date? I know that from the table MARD I can get the value of today's closing stock. But how can I know any other days closing stock. Th

  • Not sure if an update broke pacman and resolv.conf

    Hey guys           Sorry about these noobish questions but I have googled and i just cant seem to find a solution. Couple of things. First, I did a "pacman -Syu" and update the system earlier today. Then, I tried installing a package and i saw pacman

  • Single Line Text Control (H&J) Tip & Question

    The attached image is tip for anyone that is looking to constrain InDesign to use the width of a text field (maintaining a single line, good for a variable data field), while allowing characters to smash if they exceed the amount that would normally

  • Photoshop CC & Briadge CC not connected

    How to get images from Bridge CC to open in  Photoshop CC  in the file - open with - ?

  • Works fine when i run it, broken when i export release build

    I have an app that works fine when i press CTRL + F11 to test it. then when i export the release build and run it locally much of its operations dont function any longer. Any ideas why this is happening ?