I am stymied by imprecision in your questions.

On 18 Mar 2010, at 11:53 PM, Jon wrote:

> I have a class set up,   and in the header file,  I have instances of 
> NSString  that i want to hang around for all the methods of the class to be 
> able to use...(why they are declared in the header file). when i create an 
> instance of the class to use....  I have a problem.

"[I]n the header file,  I have instances of NSString" says that you have, in a 
.h file something like this:

NSString * gString = @"string contents";

That would be an instance of an NSString. You should not do this. 
Generally-usable strings should be initialized in an .m file, and exposed as 
extern in a header.

"(why they are declared in the header file)" is unclear to me. Are you asking? 
Or are you saying that the need to make them generally available is the reason 
you put them in the header (in which case, see my previous paragraph)?

Or, by "instances of NSString," do you mean that you have NSString * _instance 
variables_? That might help the rest of your question make sense.

> I create one instance of this class that hangs around while the whole program 
> is executing...  or even if it is just called up for a short time..  (this is 
> a view type of class that creates a subView over the main view...  ..
> 
> several of those methods in the class call UIAlertView,     and suddenly the 
> information in the NSStrings that i had instanced in the header of the class 
> and am actively using,  disappears  each time a method calls up a 
> UIAlertView......  i think because it is creating its own subview on top of 
> everything and all the strings instances are lost at that moment...

UIAlertView is a class. You can't "call" a class any more than you can call 
"int". Do you mean that you create, initialize, and run a UIAlertView? Show us 
your code.

What do you mean by "the information in the NSStrings that i had instanced in 
the header of the class and am actively using, disappears?" The string pointers 
become nil? They point to empty strings? Garbled strings? Released strings? The 
text of the alert just isn't what you expect? How do you know this? Have you 
stepped through the setup of the UIAlertView in the debugger and verified that 
the strings you are using are the ones you think you are using?

If (as I think possible) you mean that these strings are held by instance 
variables, how do you initialize the instance variables? Show your code, 
including the class declaration (from @interface to @end), and the code that 
sets the instance variables (in your init* method or elsewhere.

> so the question is:    what is the best way to keep "strings"  around that i 
> deem important enough to still have them  after a call to UIAlertView.??


        — F

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to