Re: wits end with nsview and nsrectfill()

2014-11-30 Thread Navneet Kumar
Thanks for the responses.

The problem is still there.

I don’t need to dynamically add or remove views and was following the wrong way 
to setup view hierarchy in drawRect:.

I have changed it to the following order: initWithFrame: then 
-(void)setupSubViews in all related classes.
So in app delegate I call initWithFrame: and then immediately setupSubViews. 
The entire view comes to front a lot later.

The view hierarchy is complex, starting with a view based outline view, then 
child of a root node has box views (2 in a row). Every box has this bottom view 
which has this problem. I’m adding a non-selectable, non-editable text field 
with setDrawsBackground set to NO, as a subview to this bottom view.

In drawRect:, I’m just using NSRectFill() with:

NSColor *bgColor = [[NSColor blackColor]blendedColorWithFraction:0.25 
ofColor:[NSColor whiteColor]];
[bgColor set];
NSRectFill([self bounds]);
And initially the background is same in text field and rest of the area. but on 
refresh, the rest of the area becomes darker, which shouldn’t be as 
NSRectFill() is supposed to draw opaquely.


Thanks,
Navneet


> On 30-Nov-2014, at 11:24 pm, Kyle Sluder  wrote:
> 
> On Nov 30, 2014, at 9:30 AM, Navneet Kumar  wrote:
>> 
>> Hi,
>> 
>> I have a custom view in which I am setting the background using NSRectFill() 
>> in drawRect:.
> 
> You’re aware that this function is only really suitable for drawing opaque 
> colors, yes? If you NSRectFill() with a transparent color, it will not blend 
> that color with the existing backing store. Instead, it will replace all 
> pixels in that rect with transparent ones, obliterating any drawing performed 
> by ancestor views in the hierarchy.
> 
>> I am also adding a text field as subview in this method.
> 
> This is not allowed. -drawRect: is for drawing, not mutating your view 
> hierarchy.
> 
> If you want to position/install views at the last possible second before the 
> drawing pass, use -viewWillDraw. But you have not offered any reasons why you 
> need to dynamically add or remove views at all, much less in tandem with the 
> drawing pass.
> 
> --Kyle Sluder

___

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

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

Xcode 6.1 - IB giving constraints warnings

2014-11-30 Thread Laurent Daudelin
I create a window in a brand new xib file. I add 3 outline views to the content 
view. I join 2 of the outline views in a split view. IB starts giving me 
constraint warning that the size should be 0,0 for the clip view. I haven’t 
added any constraint yet.

Is this a known bug?

-Laurent.
-- 
Laurent Daudelin
laur...@nemesys-soft.com 
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/ 
Logiciels Nemesys Software

___

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

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

Re: Predicate Row Template array within array

2014-11-30 Thread Keary Suska
On Nov 30, 2014, at 9:02 AM, Trygve Inda  wrote:

> {
> 
> NSString*  name;
> NSDate*date;
> NSArray*   words;
> }
> Objects;
> 
> The words array looks like:
> {
> 
> NSString*  id;
> NSString*  word;
> }
> Words;
> 
> 
> As a follow up:
> 
> When I use a left expression of:
> 
> @"words.word"
> 
> And a modifier of: NSAnyPredicateModifier
> 
> My predicate ends up as:
> 
> ANY words.word CONTAINS[cd] "Test"
> 
> But I get:
> [<__NSCFString 0x61277d00> valueForUndefinedKey:]: this class is not key
> value coding-compliant for the key word.
> 
> But it is.

Notice that the object being queried is an NSString, and not the expected 
"word" object. This either means that your "words" array contains at least one 
plain NSString, or you are experiencing a memory management issue. Break on 
exception and see what is in that NSString.

HTH,

Keary Suska
Esoteritech, Inc.



___

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

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

Re: Proper use of representedObject in segues

2014-11-30 Thread Mike Abdullah

> On 30 Nov 2014, at 19:17, Mikael Wämundson  wrote:
> 
> Hi,
> 
> I understand that when preparing for segue and sending information to the 
> ViewController of the PopUp, Sheet, etc. I should make use of the 
> representedObject of that ViewController.
> 
> So far, so good.
> 
> What, however, if I want to send information back to my parent view? Is the 
> proper way to make use of the representedObject of the 
> presentingViewController?

Typically, as part of the segue preparation, you hook the source VC up to be 
the delegate of the presented VC, and they communicate that way.


___

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

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

Proper use of representedObject in segues

2014-11-30 Thread Mikael Wämundson
Hi,

I understand that when preparing for segue and sending information to the 
ViewController of the PopUp, Sheet, etc. I should make use of the 
representedObject of that ViewController.

So far, so good.

What, however, if I want to send information back to my parent view? Is the 
proper way to make use of the representedObject of the presentingViewController?

Thanks!

/Mike


___

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

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

Re: Predicate Row Template array within array

2014-11-30 Thread Trygve Inda
{
   
NSString*  name;
NSDate*date;
NSArray*   words;
}
Objects;

The words array looks like:
{
  
NSString*  id;
NSString*  word;
}
Words;


As a follow up:

When I use a left expression of:

@"words.word"

And a modifier of: NSAnyPredicateModifier

My predicate ends up as:

ANY words.word CONTAINS[cd] "Test"

But I get:
[<__NSCFString 0x61277d00> valueForUndefinedKey:]: this class is not key
value coding-compliant for the key word.

But it is.

My class has

@property (copy, readwrite)NSString* id;
@property (copy, readwrite)NSString* word;

And they are synthesized

I am not sure what class it is trying to look at since it does not indicate
that.

Any ideas?



___

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

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

Predicate Row Template array within array

2014-11-30 Thread Trygve Inda
I have an array of objects that looks like:

{
   NSString*  name;
   NSDate*date;
   NSArray*   words;
}

The words array looks like:

{
   NSString*  id;
   NSString*  word;
}


I need to build a Predicate Row template to result in a way to search for
names, dates, and words. The first two are easy using basically:

[NSExpression expressionForKeyPath:@"name"];

template = [[NSPredicateEditorRowTemplate alloc]
initWithLeftExpressions:expressions
rightExpressionAttributeType:NSStringAttributeType
modifier:NSDirectPredicateModifier
operators:operators
options:0];

This gives me a predicate:

name CONTAINS[cd] "Fred"

But how can I build a row template to search for an object whose "words"
array contains a specific "word"?

Just in code it would be:

predicate = [NSPredicate predicateWithFormat:@"%@ IN words", someword];

How can I apply that sort of logic to my row template so that the left
expression would be "words", operators would be:

NSBeginsWithPredicateOperatorType
NSEndsWithPredicateOperatorType
NSContainsPredicateOperatorType

But that would give me:

words CONTAINS[cd] "Fred"

Which is not what I want.

How can I get the effect of the "%@ IN words" in a row template? This will
cause it to search for objects that contain a words array that contains a
specific word.

Thanks,

Trygve



___

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

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

Re: wits end with nsview and nsrectfill()

2014-11-30 Thread Kyle Sluder
On Nov 30, 2014, at 9:30 AM, Navneet Kumar  wrote:
> 
> Hi,
> 
> I have a custom view in which I am setting the background using NSRectFill() 
> in drawRect:.

You’re aware that this function is only really suitable for drawing opaque 
colors, yes? If you NSRectFill() with a transparent color, it will not blend 
that color with the existing backing store. Instead, it will replace all pixels 
in that rect with transparent ones, obliterating any drawing performed by 
ancestor views in the hierarchy.

> I am also adding a text field as subview in this method.

This is not allowed. -drawRect: is for drawing, not mutating your view 
hierarchy.

If you want to position/install views at the last possible second before the 
drawing pass, use -viewWillDraw. But you have not offered any reasons why you 
need to dynamically add or remove views at all, much less in tandem with the 
drawing pass.

--Kyle Sluder
___

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

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

Re: wits end with nsview and nsrectfill()

2014-11-30 Thread Navneet Kumar
Thank you Steve and Mike.
I'll try it tomorrow and post the result here.

Wishes,
Navneet
Sent from my iPhone

> On 30-Nov-2014, at 11:13 pm, Steve Christensen  wrote:
> 
> Why aren't you creating the subview in -initWithFrame: or in a 
> nib/storyboard? The purpose of -drawRect: is solely to [re-]draw the contents 
> of one view, not build a view hierarchy. I expect that modifying the view 
> hierarchy while in the middle of a drawing cycle is leaving views in an 
> inconsistent state.
> 
> 
>> On Nov 30, 2014, at 9:30 AM, Navneet Kumar  wrote:
>> 
>> I have a custom view in which I am setting the background using NSRectFill() 
>> in drawRect:. I am also adding a text field as subview in this method. The 
>> textfield is non-selectable, non-editable and is not set to draw background.
>> 
>> When the view comes to front, the background is same, but when it refreshes, 
>> the area apart from the text field becomes a bit darker and the text field 
>> area shows the original background, this creates a contrast which I want to 
>> get rid of.
>> 
>> The view is set to return YES to isOpaque.
>> 
>> I have tried a lot of things but to no avail.
>> I have tried CGContext approach to fill rect.
>> I also tried setting the color before NSRectFill() to a opaque color as well.
>> 
>> The problem is gone if I removeFromSuperview and create the custom view 
>> again and again on each drawRect: of the super view. But this consumes a lot 
>> of CPU.
>> 
>> An image showing the contrast is attached herewith.
>> 
>> Please help.
>> 
>> Best,
>> Navneet
> 

___

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

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

Re: wits end with nsview and nsrectfill()

2014-11-30 Thread Steve Christensen
Why aren't you creating the subview in -initWithFrame: or in a nib/storyboard? 
The purpose of -drawRect: is solely to [re-]draw the contents of one view, not 
build a view hierarchy. I expect that modifying the view hierarchy while in the 
middle of a drawing cycle is leaving views in an inconsistent state.


> On Nov 30, 2014, at 9:30 AM, Navneet Kumar  wrote:
> 
> I have a custom view in which I am setting the background using NSRectFill() 
> in drawRect:. I am also adding a text field as subview in this method. The 
> textfield is non-selectable, non-editable and is not set to draw background.
> 
> When the view comes to front, the background is same, but when it refreshes, 
> the area apart from the text field becomes a bit darker and the text field 
> area shows the original background, this creates a contrast which I want to 
> get rid of.
> 
> The view is set to return YES to isOpaque.
> 
> I have tried a lot of things but to no avail.
> I have tried CGContext approach to fill rect.
> I also tried setting the color before NSRectFill() to a opaque color as well.
> 
> The problem is gone if I removeFromSuperview and create the custom view again 
> and again on each drawRect: of the super view. But this consumes a lot of CPU.
> 
> An image showing the contrast is attached herewith.
> 
> Please help.
> 
> Best,
> Navneet


___

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

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

Re: wits end with nsview and nsrectfill()

2014-11-30 Thread Mike Abdullah

> On 30 Nov 2014, at 17:30, Navneet Kumar  wrote:
> 
> Hi,
> 
> I have a custom view in which I am setting the background using NSRectFill() 
> in drawRect:. I am also adding a text field as subview in this method.

I suspect there-in you have your problem. -drawRect: is for drawing. Do not 
modify the view hierarchy from within it.


___

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

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

wits end with nsview and nsrectfill()

2014-11-30 Thread Navneet Kumar
Hi,

I have a custom view in which I am setting the background using NSRectFill() in 
drawRect:. I am also adding a text field as subview in this method. The 
textfield is non-selectable, non-editable and is not set to draw background.

When the view comes to front, the background is same, but when it refreshes, 
the area apart from the text field becomes a bit darker and the text field area 
shows the original background, this creates a contrast which I want to get rid 
of.

The view is set to return YES to isOpaque.

I have tried a lot of things but to no avail.
I have tried CGContext approach to fill rect.
I also tried setting the color before NSRectFill() to a opaque color as well.

The problem is gone if I removeFromSuperview and create the custom view again 
and again on each drawRect: of the super view. But this consumes a lot of CPU.

An image showing the contrast is attached herewith.

Please help.

Best,
Navneet
___

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

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

Re: App fails on Yosemite - "Cannot remove an observer"

2014-11-30 Thread Bill Cheeseman

> On Nov 30, 2014, at 12:24 AM, Jerry Krinock  wrote:
> 
> Search for the AppKit Release Notes for OS X 10.10 Yosemite and carefully 
> read the section on tab views, wherein Apple has added alot of new stuff, 
> which may be stepping on your old stuff.


Changing the subject, but isn't it odd that the Yosemite AppKit Release Note 
still says this: "These notes apply to seed 5 of OS X Yosemite, released early 
August. Sections updated since the WWDC seed are marked. These notes do not yet 
cover all of the changes in the Application Kit in OS X 10.10." And here we are 
at 10.10.1 already, with 10.10.2 presumably looming on the horizon.

-- 

Bill Cheeseman - b...@cheeseman.name

___

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

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