Re: strange NSTextView problem
Re: strange NSTextView problem
- Subject: Re: strange NSTextView problem
- From: Andy Lee <email@hidden>
- Date: Sun, 17 Jul 2011 07:11:21 -0400
You could use ibtool to convert the nib to xml.
But it seems to me you've established that rich text is in fact enabled when you enter these lines of code. If you're not convinced, you can add the line
NSLog(@"Rich? %d", [textView isRichText]);
You've narrowed down the problem to one line of code, which is the call to setTextColor:. This *could* be a red herring, but I'd focus on that discovery.
* Is setTextColor: deprecated in Lion by any chance?
* Could Lion have introduced a bug such that it turns off the rich text flag? That would be very strange, but easy to rule out by putting the above NSLog after the call to setTextColor:.
* Could Lion have introduced a bug such that setTextColor: throws a silent exception and your remaining lines are never executed? You could check by putting an NSLog or breakpoint at the end and seeing if it's ever reached.
* What if you pass a different color, like [NSColor redColor]? Or nil? Or if you use colorWithDeviceWhite:alpha:?
* Can you make a minimal test program that reproduces this problem? It should be pretty easy to show if it's a bug in Lion.
--Andy
On Jul 17, 2011, at 4:32 AM, Rick Corteza wrote:
> ok i tried a diff and it prints out nothing for the .xib files. now for the
> compiled .nib files it simply prints out differ but how to get more info out
> of it? can it do a proper diff on a compiled nib?
>
>
>
> On Sun, Jul 17, 2011 at 11:07 AM, Kyle Sluder <email@hidden> wrote:
>
>> On Sat, Jul 16, 2011 at 7:47 PM, Rick C. <email@hidden> wrote:
>>> Thanks for the reply. I don't have many attributes here goes:
>>>
>>> [textView setTextColor:[NSColor colorWithCalibratedWhite:(250.0f /
>> 255.0f) alpha:1]];
>>> NSShadow *textShadow = [[NSShadow alloc] init];
>>> [textShadow setShadowOffset:NSMakeSize(-0.5, -1)];
>>> [[textView textStorage] addAttributes:[NSDictionary
>> dictionaryWithObject:textShadow forKey:NSShadowAttributeName]
>> range:NSMakeRange(0, [[textView textStorage] length])];
>>> [textView setFont:[NSFont boldSystemFontOfSize:10.0]];
>>> [textShadow release];
>>
>> Are you doing this in -awakeFromNib? I'm wondering if the nib got
>> rejiggered in the transition, and now NSTextView's -awakeFromNib is
>> causing it to not accept rich text at the time you're manipulating its
>> text storage, only to turn on rich text right afterwards.
>>
>> --Kyle Sluder
>>
> _______________________________________________
>
> 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
_______________________________________________
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