• 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
Re: display int in cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: display int in cocoa


  • Subject: Re: display int in cocoa
  • From: John Stiles <email@hidden>
  • Date: Wed, 10 Oct 2007 11:15:11 -0700

Try an NSTextField. An NSTextView is a little more complicated than what you need in this case.
FWIW your casting code is completely broken, don't even try to go down that route. initWithFormat is more on the right track.



On Oct 10, 2007, at 11:10 AM, Erfan Aleemullah wrote:

Hi,
I am trying to display an int as a page number in cocoa so the user knows
which page he is currently on.
the page number automatically increments itself.


I looked into NSTextview but could not get it to work. Most methods accept
type NSString in their setTitle or similar function- so is there a way to
cast an int to NSString?


What would be the best way to display the int in cocoa ?

Error casting code:

int x = 0;

char *a =(char *)x;

NSString* temp2 = [[NSString alloc] initWithCString: a];

I am currently achieving this effect using setTitle of NSButton class and
using a disabled NSButton as the output for the page number.


current = [[NSString alloc] initWithFormat:@"%d",page];

[CurrentPage setTitle:current];

[current release];


Thanks. _______________________________________________

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:
40blizzard.com


This email sent to email@hidden

_______________________________________________

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


References: 
 >display int in cocoa (From: "Erfan Aleemullah" <email@hidden>)

  • Prev by Date: display int in cocoa
  • Next by Date: Re: display int in cocoa
  • Previous by thread: display int in cocoa
  • Next by thread: Re: display int in cocoa
  • Index(es):
    • Date
    • Thread