On 24 May 2012, at 1:57 PM, Jason Teagle wrote:
> If the CGContextXXX methods shouldn't be used, then they shouldn't be in the
> API - or should be marked as deprecated. There's nothing in the docs (with
> Xcode 3.X, at least - maybe it's changed since) to indicate that these were
> the worst w
Thanks for all the replies regarding %s vs. %@, and the rather
disastrous attempt at using CGContextXXX methods. Even if I had fixed
all the other issues, I was using CGContextSelectFont incorrectly
anyway. I didn't have a hope. That, unfortunately, is down to
documentation not being complete /
On May 24, 2012, at 2:49 AM, Jason Teagle wrote:
> First, a quick question about +stringWithFormat: If I want to have a literal
> string as one of the parameters to the format, which is correct / best:
>
> NSString *textToDraw = [NSString stringWithFormat: @"%s",
>
On May 24, 2012, at 5:50 AM, Jason Teagle wrote:
> (I've since discovered that the %@ and @"xxx" way works just fine, so I'll
> stick with that.
Good :) The problem with using "%s" is that it doesn't work well with non-ASCII
characters. Cocoa has to assume some character encoding to map the by
On May 24, 2012, at 10:36 AM, Manfred Schwind wrote:
>> CGContextShowTextAtPoint(contextRef, 0, 40,
>>[textToDraw UTF8String], [textToDraw length]);
>
> One bug I see here: you're passing a wrong length parameter.
Another bug: CGContextShowztextAtPoint takes characters encoded in MacRoman,
On May 24, 2012, at 9:36 AM, Manfred Schwind wrote:
>> CGContextShowTextAtPoint(contextRef, 0, 40,
>> [textToDraw UTF8String], [textToDraw length]);
>
> One bug I see here: you're passing a wrong length parameter.
> CGContextShowTextAtPoint expects the length of the char array (number of
>
On 24 May 2012, at 15:36, Manfred Schwind wrote:
>> CGContextShowTextAtPoint(contextRef, 0, 40,
>> [textToDraw UTF8String], [textToDraw length]);
>
> One bug I see here: you're passing a wrong length parameter.
> CGContextShowTextAtPoint expects the length of the char array (number of
> byte
> CGContextShowTextAtPoint(contextRef, 0, 40,
> [textToDraw UTF8String], [textToDraw length]);
One bug I see here: you're passing a wrong length parameter.
CGContextShowTextAtPoint expects the length of the char array (number of bytes
of the UTF-8 encoded string), but you'e passing the numb
You probably want UILabel. UITextView is a much more heavyweight class
that supports editing as well as display.
(My bad, a label is called a TextView on Android - got mixed up.)
These both are just wasting CPU cycles and adding extraneous code.
Simply use:
NSString *textToDraw = @"my stri
Have a look at this doc-page:
https://developer.apple.com/library/mac/ipad/#documentation/graphicsimaging/
>conceptual/drawingwithquartz2d/dq_text/dq_text.html
It discusses your options when drawing text with Quartz2D, and also mentions
>other techniques.
>One option of note is the NSString ad
y aim is to render a particular string in a particular colour, in a
> particular font (or, any Sans Serif of the system's choosing would be
> enough here) and a particular font size.
>
> First, a quick question about +stringWithFormat: If I want to have a
> literal string as on
and a particular font size.
>
> First, a quick question about +stringWithFormat: If I want to have a literal
> string as one of the parameters to the format, which is correct / best:
>
> NSString *textToDraw = [NSString stringWithFormat: @"%s",
>"m
in a
particular font (or, any Sans Serif of the system's choosing would be
enough here) and a particular font size.
First, a quick question about +stringWithFormat: If I want to have a
literal string as one of the parameters to the format, which is correct
/ best:
NSString *textToDraw =
On Jul 3, 2009, at 8:27 PM, Andy Lee wrote:
On Jul 3, 2009, at 11:20 PM, KK wrote:
Hello,
I have a NSString (from a property list file) that has the %@
formats in
it... So.. I do something like this:
NSString *stringFromPlistFile;
NSString *newString = [NSString stringWithFormat:stringFrom
On Jul 3, 2009, at 11:20 PM, KK wrote:
Hello,
I have a NSString (from a property list file) that has the %@
formats in
it... So.. I do something like this:
NSString *stringFromPlistFile;
NSString *newString = [NSString stringWithFormat:stringFromPlistFile,
@"Hello"];
But that doesn't work...
Hello,
I have a NSString (from a property list file) that has the %@ formats in
it... So.. I do something like this:
NSString *stringFromPlistFile;
NSString *newString = [NSString stringWithFormat:stringFromPlistFile,
@"Hello"];
But that doesn't work...
Keita
On Mon, Oct 20, 2008 at 3:25 AM, Ron Green <[EMAIL PROTECTED]> wrote:
> stringWithFormat: returns an NSString that is autoreleased. I know this
> because I read it in Hillegasses book. But since this does not seem to be
> covered in the documentation, if I had not read it in a bo
"You "create" an object using a method whose name begins with “alloc”
or “new” or contains “copy” (for example, alloc, newObject, or
mutableCopy)."
"Many classes provide methods of the form +className... that you can
use to obtain a new instance of the class. Often referred to as
“conve
Ron Green wrote:
stringWithFormat: returns an NSString that is autoreleased. I know
this because I read it in Hillegasses book. But since this does not
seem to be covered in the documentation, if I had not read it in a
book, how would I discover that the NSString was autoreleased
stringWithFormat: returns an NSString that is autoreleased. I know
this because I read it in Hillegasses book. But since this does not
seem to be covered in the documentation, if I had not read it in a
book, how would I discover that the NSString was autoreleased
Aron & Ken,
Yes thank you both that has been driving me crazy mostly because I
knew it was something stupid like that.
Thank you,
Mike Swan
"Change itself is not painful it is resistance to change that causes
pain."
___
Cocoa-dev mailing list (C
The parentheses are not correct in that position.
You're using the C comma operator
(http://www.eskimo.com/~scs/cclass/int/sx4db.html) and passing one
argument to stringWithFormat:, which is the count of the array. That
isn't a pointer.
-Ken
On Mon, Jul 21, 2008 at 9:23 PM, Mi
I think the parens around the argument to stringWithFormat: are
causing the compiler to interpret the comma as a C comma operator,
which means the result of the first expression (your format string) is
ignored, and the result of the second expression ([array count]) is
treated as the
So I have done the standard Google search and clean all targets but
neither has helped. I have the following two lines of code:
NSLog(@"array count = %i",[array count]); // This works just
fine
NSString *string = [NSString stringWithFormat:(@"array count
On Tue, Apr 8, 2008 at 8:33 PM, Stuart Green <[EMAIL PROTECTED]> wrote:
> returnString = [NSString stringWithFormat:@"%c-%i-%i-%f",
> asciiString, firstDouble, secondDouble, thirdDouble];
You have a format string for character-integer-integer-float/double,
not
On Apr 8, 2008, at 12:33 PM, Stuart Green wrote:
returnString = [NSString stringWithFormat:@"%c-%i-%i-%f",
asciiString, firstDouble, secondDouble, thirdDouble];
Which is producing a weird output when used outside of an NSLog.
Examining each parameter in the debugger shows exac
Try casting them to ints before formatting:
returnString = [NSString stringWithFormat:@"%c-%i-%i-%f", asciiString,
(int)firstDouble, (int)secondDouble, thirdDouble];
On Apr 8, 2008, at 1:33 PM, Stuart Green wrote:
Hi,
I have a string declaration of:
returnString =
On Apr 8, 2008, at 1:33 PM, Stuart Green wrote:
Hi,
I have a string declaration of:
returnString = [NSString stringWithFormat:@"%c-%i-%i-%f",
asciiString, firstDouble, secondDouble, thirdDouble];
If asciiString really is an ASCII (null-terminated) string, then you
need to use
Hi,
I have a string declaration of:
returnString = [NSString stringWithFormat:@"%c-%i-%i-%f",
asciiString, firstDouble, secondDouble, thirdDouble];
Which is producing a weird output when used outside of an NSLog.
Examining each parameter in the debugger shows exactly what I w
29 matches
Mail list logo