Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

array data from other viewcontroller

ahsan123ahsan123 Posts: 39Registered Users
edited August 2011 in iPhone SDK Development
Hello everyone

I have made an application in which I have UITableview and UIView. In UIView I have a text field i which entered data must be save in the UITableView Controller. For this I have done thi:


Today *today=[[Today alloc]initWithStyle:UITableViewStylePlain];
AddTasks *add=[[AddTasks alloc]init];
[today.array insertObject:add.tName.text atIndex:[today.array count]];
NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
[defaults setObject:today.array forKey:@\"todayArray\"];
[defaults synchronize];



Note: TodayTasks is UITableView controller and AddTasks is UIView for entering data.

But I am facing failure in this. Can any one help me.

Thanks
Post edited by ahsan123 on

Replies

  • MattWMattW Posts: 241Registered Users
    edited August 2011
    ahsan123;367824 said:
    Hello everyone

    I have made an application in which I have UITableview and UIView. In UIView I have a text field i which entered data must be save in the UITableView Controller. For this I have done thi:


    Today *today=[[Today alloc]initWithStyle:UITableViewStylePlain];
    AddTasks *add=[[AddTasks alloc]init];
    [today.array insertObject:add.tName.text atIndex:[today.array count]];
    NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
    [defaults setObject:today.array forKey:@\"todayArray\"];
    [defaults synchronize];



    Note: TodayTasks is UITableView controller and AddTasks is UIView for entering data.

    But I am facing failure in this. Can any one help me.

    Thanks
    You're going to have to be a bit more descriptive.... what exactly does 'facing failure' mean? Does the app crash? Does it compile? What happens?
    [SIGPIC][/SIGPIC]

    Highlight PDF text like no other app: iHighlight (now available for iPad and iPhone!)

    -----

    Create iPhone lists with no typing: <a
  • ahsan123ahsan123 Posts: 39Registered Users
    edited August 2011
    no it doesn't crashes. the failure I am facing is "Data is not being entered"

    thanks
  • MattWMattW Posts: 241Registered Users
    edited August 2011
    ahsan123;367833 said:
    no it doesn't crashes. the failure I am facing is "Data is not being entered"

    thanks
    Well, seeing as you create 'add' one line before you add it to the UITableView, my guess is that the text field is empty (unless your AddView init() call populates the text field with some data).

    You'll need to have some data in your text field before you add it to your table view.
    [SIGPIC][/SIGPIC]

    Highlight PDF text like no other app: iHighlight (now available for iPad and iPhone!)

    -----

    Create iPhone lists with no typing: <a
  • ahsan123ahsan123 Posts: 39Registered Users
    edited August 2011
    Sorry I did not understand please can you explain please. I do put text in textfield but even then it does not put into the array of UITableView List.

    for explaining you:
    I have done this in array

    array=[[NSMutableArray array]retain];



    This is TableView array. Means Today's page array
  • MattWMattW Posts: 241Registered Users
    edited August 2011
    ahsan123;367856 said:
    Sorry I did not understand please can you explain please. I do put text in textfield but even then it does not put into the array of UITableView List.

    for explaining you:
    I have done this in array

    array=[[NSMutableArray array]retain];



    This is TableView array. Means Today's page array
    The text field you're adding will be nil because you've only just created it, so there's no data to add to your array:


    Today *today=[[Today alloc]initWithStyle:UITableViewStylePlain];
    AddTasks *add=[[AddTasks alloc]init];

    // *** At this point, the text field of add.tName will be blank because you have only just initialized it with the line above.

    [today.array insertObject:add.tName.text atIndex:[today.array count]];
    [SIGPIC][/SIGPIC]

    Highlight PDF text like no other app: iHighlight (now available for iPad and iPhone!)

    -----

    Create iPhone lists with no typing: <a
  • ahsan123ahsan123 Posts: 39Registered Users
    edited August 2011
    Hello MattW

    I haven't just created the textfield. Actually I do put data in text field after running the program but when I check the tableview, it shows empty.
    It is not being done with this too. It is not showing the string.

    [today.array insertObject:@\"hello\" atIndex:[today.array count]];

Sign In or Register to comment.