• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to set value to UITextField using App Delegate in a Tabbar application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to set value to UITextField using App Delegate in a Tabbar application


  • Subject: How to set value to UITextField using App Delegate in a Tabbar application
  • From: "Nabi, Reza" <email@hidden>
  • Date: Tue, 9 Mar 2010 07:50:30 -0500
  • Acceptlanguage: en-US
  • Thread-topic: How to set value to UITextField using App Delegate in a Tabbar application

Hello:
Below is the document view of MainWindow.xib where I have 2 tabs (Plan One and Plan Two).

-- Files Owner
-- App Delegate (CPSAppDelegate)
-- Window
-- Tab Bar Controller (rootController : UITabBarController)
-- -- -- Tab Bar
-- -- -- Plan One Navigation Controller (PlanOneNavController : UINavigationController)
-- -- -- -- -- Region Table View Controller (PlanOneTableViewControler ---> RegionTableView.xib)
-- -- -- -- -- Plan One View Controller (PlanOneViewController ---> PlanOneView.xib)

-- -- -- Plan Two Navigation Controller (PlanTwoNavController : UINavigationController)
-- -- -- -- -- Region Two Table View Controller (PlanTwoTableViewControler ---> RegionTwoTableView.xib)
-- -- -- -- -- Plan Two View Controller (PlanTwoViewController ---> PlanTwoView.xib)


By default, Plan One tab is loaded with "RegionTableView.xib" under PlanOneNavController stack which displays list of regions in table view. When user click on a region, "PlanOneView.xib" is pushed on top of PlanOneNavController stack.

In PlanOneView.xib file, I have UITextField (Outlest name is: txtCrop) which I want to set some value from outside using app delegate. I was trying with the following code to set value to txtCrop outlet but it is not working.

- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath
{
selection = [[self.itemArray objectAtIndex:[newIndexPath row]] retain];

// Update the Crop text field with the selected crop
CPSAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.planOneViewController.txtCrop setText:selection];
}

I was wondering if there is any expert who can give me some guidance on how to make the call correctly using app delegate such that when a row is selected (didSelectRowAtIndexPath method), it automatically update the txtCrop outlet in PlanOneView.xib file with the selected value (selection variable).

If anybody interested in trying the code, please feel free to download from http://orcausa.org/cps.zip and do the following:
1. Fire up the project, build and go
2. Click on any region in Plan one tab
3. Click on 'V' button next to the txtCrop outlet (UITextField), the first one
4. Select a crop and click on 'OK' button.

The goal / intention is to  populate selected item to the txtCrop outlet (UITextField) of PlanOneView.xib

Any help/pointer/guidance on how to make the call correctly would be greatly appreciated.

Thank you so much.


Reza.




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Question Re Memory Management in Apps
  • Next by Date: Re: NSTextView attachments and context menus
  • Previous by thread: Re: Question Re Memory Management in Apps
  • Next by thread: MoviePlayer_iPhone sample code in XCode 3.2
  • Index(es):
    • Date
    • Thread