• 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
NSString, NSArray, get the characters of one of the NSString in an Array of NSStrings?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString, NSArray, get the characters of one of the NSString in an Array of NSStrings?


  • Subject: NSString, NSArray, get the characters of one of the NSString in an Array of NSStrings?
  • From: Michel Haver <email@hidden>
  • Date: Fri, 13 Jul 2001 18:27:47 +0200

Let me state my problem more clearly, because I still messing around with
the following problem.

In C/C++ you can use an Array of Strings, for example 3 strings of 12
characters can be stored in an Array.

Char drawstring [3] [12];

Strcpy (drawString [ 1 ], 3cocoaforall12);
Strcpy (drawString [ 2 ], 3cocoaforall22);
Strcpy (drawString [ 3 ], 3cocoaforall32);


Then I want to draw the characters of one of the three drawString on screen
in a circle:

for ( i = 0; i < 12; i++) {
radianAngle = (pi * (drawAngle - 90) / 180);
x = (screenLocation.x + 130 * cos(radianAngle));
y = (screenLocation.y + 130 * sin(radianAngle));

//Display the characters of the drawString

drawString = [1] [ i ];

// Display the drawstring in the cocoa way
[ drawString drawAtPoint: NSMakePoint(x, y) withAttributes: attrs ];


drawAngle = drawAngle + 15;
}



My problem is if I implement this idea in cocoa, I stumble against the
conversion issue between NSArray and NSString

The assignment is made with statement

drawCharacterOfString =[scrambledRound1PlayStringArray
objectAtIndex:10];

The compiler accepts that, but if I try to use the follwing statement
drawString = [ drawCharacterOfString characterAtIndex : i ];

I get a warning:

assignment makes pointer from integer without a cast

and my application quits.


But I don't know why?

So I am trapped in NSString NSArray paradox here.

Is there I way to implement my example in cocoa by using the right
combination of NSString, NSMutableArray, NSArray, NSMutableString?



Thanks for the help so far.

Cheers

Michel


  • Follow-Ups:
    • Re: NSString, NSArray, get the characters of one of the NSString in an Array of NSStrings?
      • From: Douglas Davidson <email@hidden>
    • Re: NSString, NSArray, get the characters of one of the NSString in an Array of NSStrings?
      • From: Andreas Monitzer <email@hidden>
  • Prev by Date: Re: Look And Feel (Guidelines
  • Next by Date: Re: Auto-opening a Drawer
  • Previous by thread: Fwd: Saving TIFF
  • Next by thread: Re: NSString, NSArray, get the characters of one of the NSString in an Array of NSStrings?
  • Index(es):
    • Date
    • Thread