Rotated and scaled CALayer

2010-10-21 Thread Rimas M.
Hello list,

I do not have a lot of practice with Core Animation, maybe that is the
reason. I have a real annoying problem.

All I want to do is:
1. Create CALayer
2. Set CGImage for its content
3. Depending on situation rotate and zoom in that layer (or its content)

Looks like everything works, but I am getting "rotated" pixels
(http://dl.dropbox.com/u/2030721/ForAppleList/Rotated%20Pixels.png).
That is not what I want. I would like to get rotated content of image
with "straight" pixels.

I was trying to play with layer transform property, with layer
delegate "- (void)drawLayer:(CALayer *)layer
inContext:(CGContextRef)ctx" and by using CGContextRotateCTM etc. I
have even tried to use layer and sublayer to split transforms (one
layer scales, and other rotates) but result is always the same.
Is there any way to achieve result I want? Currently the only way I know is:
a) to rotate an image by drawing it to the bitmap context
b) create new rotated CGImage from it
c) and then draw it for scaling.

But this way is quite slow. Is there a better one?

Any help is very appreciate.

Best Regards,

Rimas M.
___

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

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


Re: Rotated and scaled CALayer

2010-10-21 Thread Andreas Grosam

On Oct 21, 2010, at 10:56 AM, Rimas M. wrote:

> Hello list,
> 
> I do not have a lot of practice with Core Animation, maybe that is the
> reason. I have a real annoying problem.
> 
> All I want to do is:
> 1. Create CALayer
> 2. Set CGImage for its content
> 3. Depending on situation rotate and zoom in that layer (or its content)
> 
> Looks like everything works, but I am getting "rotated" pixels
> (http://dl.dropbox.com/u/2030721/ForAppleList/Rotated%20Pixels.png).
> That is not what I want. I would like to get rotated content of image
> with "straight" pixels.
> 
> I was trying to play with layer transform property, with layer
> delegate "- (void)drawLayer:(CALayer *)layer
> inContext:(CGContextRef)ctx" and by using CGContextRotateCTM etc.
> I have even tried to use layer and sublayer to split transforms (one
> layer scales, and other rotates) but result is always the same.
> Is there any way to achieve result I want? Currently the only way I know is:
> a) to rotate an image by drawing it to the bitmap context
> b) create new rotated CGImage from it
> c) and then draw it for scaling.
> 
> But this way is quite slow. Is there a better one?
> 
> Any help is very appreciate.

- You should add your new layer as a sublayer to the layer of the 
view-controller's view - or as a sublayer to any other layer than the 
controller view's layer.

- Usually, you "draw" the contents only once. However, when you set an *image* 
via the layers's contents property, you don't need to explicitly draw the layer 
- the layer draws the image for you, when it is required. So, just set the 
image as the layer's contents.

- You can scale/zoom the layers's contents by setting the layer's transform 
property accordingly. This uses Core Animation, which executes - if possible - 
on the GPU, and is therefore the fastest method. Note, this doesn't require the 
image to be "drawn" again (it requires "rendering").
You can create a suitable transform which scales AND zooms at once.

- A CALayer's properties are "animatable" (see Core Animation). In fact, 
changes in properties are animated by default. But you can define any 
animation, and CA nicely performs them for you.

- Using Core Graphics functions is *usually* not as fast as Core Animation (if 
a CA alternative exists). But certainly, CG has its use. So, if you want to 
scale and zoom interactively, use CA. 

Regarding transforms, see also:
CATransform3DMakeRotation, CATransform3DMakeScale, CATransform3DConcat


Regards,

Andreas


> 
> Best Regards,
> 
> Rimas M.
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/agrosam%40onlinehome.de
> 
> This email sent to agro...@onlinehome.de

___

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

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


Custom drawing in NSTokenField or replacement?

2010-10-21 Thread Ben Lachman
So in light or yesterday's announcement...

I'm looking for a way to draw custom tokens in a NSTokenField subclass without 
using SPIs.  The only way I've found so far is to class dump 
NSTokenAttachment/NSTokenAttachmentCell and then subclass them.  Does anyone 
have ideas on how one might customize drawing for tokens in NSTokenField using 
all public APIs?  Alternatively, if there's a token field replacement out there 
floating around I'd love to hear about it.

Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: blach...@mac.com
twitter: @benlachman
mobile: 740.590.0009

___

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

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


Re: Core Data Sequence Problem

2010-10-21 Thread Dado Colussi
>
>1. User removes the managed object from the existing document (using
> array controller), presses the close window button, changes are not saved.

2. Managed object is removed from the managed object context by the
> frameworks and is no longer reachable by any means that I am aware of.
>


You should eliminate the dependency to the graphics context.

As a quick fix, you could add -delete method in your managed object class,
and make it remove itself from the context. When user removes an object,
invoke the -delete method, and you have an opportunity to do your cleanup.

/Dado
___

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

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


kCFStreamPropertyFTPFileTransferOffset and Resuming FTP uploads

2010-10-21 Thread David Alter
Does anyone know if kCFStreamPropertyFTPFileTransferOffset is implemented?
According to this conversation back in 2007 it is not
http://lists.apple.com/archives/macnetworkprog/2007/Mar/msg00067.html

I need to provide pause and resume support for FTP and FTPS uploads in a
cocoa application. I have CFNetwork code already working to do the FTP
uploads. It would be nice to not have to use a new framework or library to
support resuming a FTP session.

Thanks for the help.
-dave
___

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

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


Re: MPMoviePlayerViewController orientation

2010-10-21 Thread Rainer Standke
For whatever it's worth I have solved this problem. Or, rather, I have found 
another way to get the desired result.

In the docs for MPMoviePlayerViewController it says: "... you can incorporate a 
movie player view controller wherever you would normally use a view 
controller." This is what I did with the results I complained about.

It turns out that when I instantiate the MPMoviePlayerViewController, but don't 
push it myself, things behave as expected. I call 
'presentMoviePlayerViewControllerAnimated:newMPMoviePlayerViewController on the 
previous view controller.

There is a quirk worth mentioning, and that is that in the simulator the 'Done' 
button doesn't get drawn, but it's functionality is there: just click in the 
upper left to dismiss the entire thing. On the device the button is drawn as 
expected.

Rainer 


On Oct 20, 2010, at 13:36 , Rainer Standke wrote:

> Hello,
> 
> I have an iPhone project where I am using an MPMoviePlayerViewController to 
> display a movie. It is initialized with a URL, and the movie does indeed 
> start playing, in portrait orientation.
> 
> I want this to happen in landscape orientation, ideally doing autorotations. 
> 
> In my subclass of MPMoviePlayerViewController I have this method:
> 
> - 
> (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
>  {
>NSLog(@"rotating to: %d", interfaceOrientation);
>   NSLog(@"device orient: %d", [[UIDevice currentDevice] orientation]);
>   NSLog(@"UI orient: %d", self.interfaceOrientation);
>   
>   NSLog(@"generatesDeviceOrientationNotifications: %d", [[UIDevice 
> currentDevice] isGeneratingDeviceOrientationNotifications]);
>   return YES;
> }
> 
> This method does get called when I rotate the device away from portrait, in 
> which it first appears. The UI orientation never changes away from 1 = 
> portrait.
> 
> I have also implemented this:
> 
> - 
> (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
>  duration:(NSTimeInterval)duration
> {
>   NSLog(@"will rotate");
> }
> 
> This does get called, but the UI rotation never happens.
> 
> What can I do to get a) the movie to play in landscape, and b) the UI to 
> autorotate?
> 
> Thanks a lot,
> 
> Rainer
> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/lists%40standke.com
> 
> This email sent to li...@standke.com

___

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

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


What causes CGEventTap to be automatically disabled?

2010-10-21 Thread eveningnick eveningnick
Hello
i have an application that installs several active event taps (active
- those that can modify and filter events) into another application. I
activate them (CGEventTapEnable) and deactivate them only when my app
quits.

In some moments i find out (using application ET Testbench) that my
active event tap is disabled (when i have not called CGDisableEventTap
nowhere!).  I am pretty sure, i am not calling
CGEventTapEnable(myactivetap, NO) nowhere else, except when my app
finishes.

What could cause that behavior?
Can another application "spit out" and disable my installed tap? What
could be the other reasons? I feel like i'm completely lost, i don't
know from what side to approach to this problem. what are the
conditions for OS X to automatically disable event tap? (like, calling
CGRelease, or quitting the process that had installed that tap)?
Thanks for any hint!
George
___

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

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


Re: What causes CGEventTap to be automatically disabled?

2010-10-21 Thread Bill Cheeseman

On Oct 21, 2010, at 3:31 PM, eveningnick eveningnick wrote:

> In some moments i find out (using application ET Testbench) that my
> active event tap is disabled (when i have not called CGDisableEventTap
> nowhere!).  I am pretty sure, i am not calling
> CGEventTapEnable(myactivetap, NO) nowhere else, except when my app
> finishes.
> 
> What could cause that behavior?


The event taps documentation ("Quartz Event Services Reference," if I recall 
correctly) explains that the system automatically disables an event tap 
whenever the system determines that the event tap is slowing the system down. 
When this happens, you receive a special notification, and from the 
notification you can tell whether the event tap was disabled by the user or by 
the system. Your program should normally respond to the system disabled event 
by re-enabling the event tap, but other strategies are possible.

Any software that makes use of event taps should include a routine to watch for 
the system disabled event, so that you can re-enable the event tap immediately 
and avoid losing functionality.

--

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

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


malloc_error_break

2010-10-21 Thread koko
Not a Cocoa topic but I am thinking the smart guys here can show me  
the error of my ways.


I do this:

BYTE *destination = (BYTE*)malloc(size);

... do stuff

free(destination);

The free() gives this error

malloc: *** error for object 0x21568580: Non-aligned pointer being  
freed (2)


How can I avoid this?

-koko
___

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

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


Re: malloc_error_break

2010-10-21 Thread David Duncan

On Oct 21, 2010, at 1:44 PM, k...@highrolls.net wrote:

> Not a Cocoa topic but I am thinking the smart guys here can show me the error 
> of my ways.
> 
> I do this:
> 
> BYTE *destination = (BYTE*)malloc(size);
> 
> ... do stuff
> 
> free(destination);
> 
> The free() gives this error
> 
> malloc: *** error for object 0x21568580: Non-aligned pointer being freed (2)
> 
> How can I avoid this?


Did you perhaps change destination between malloc() and free()?
--
David Duncan

___

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

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


Re: malloc_error_break

2010-10-21 Thread koko


On Oct 21, 2010, at 2:48 PM, David Duncan wrote:



On Oct 21, 2010, at 1:44 PM, k...@highrolls.net wrote:

Not a Cocoa topic but I am thinking the smart guys here can show me  
the error of my ways.


I do this:

BYTE *destination = (BYTE*)malloc(size);

... do stuff

free(destination);

The free() gives this error

malloc: *** error for object 0x21568580: Non-aligned pointer being  
freed (2)


How can I avoid this?



Did you perhaps change destination between malloc() and free()?



Yes I did as I was memcpy'ing  to it.  I had saved it in another  
variable and I now free that and problem goes away.


Thanks!



--
David Duncan




___

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

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


Re: Custom drawing in NSTokenField or replacement?

2010-10-21 Thread Jerry Krinock

On 2010 Oct 21, at 11:22, Ben Lachman wrote:

> Alternatively, if there's a token field replacement out there floating around 
> I'd love to hear about it.

I've modified Robert Pointon's RPTagCloud to have more token-field features, 
and changed the name to RPTokenControl.  There's still alot of work that should 
be done; in particular, it should provide one of those Interface Builder 
palettes (or whatever they call them nowadays).  As is you must instantiate as 
a Custom View and configure it completely in code.  But it works for me:

http://sheepsystems.com/sourceCode/sourceRPTokenControl.html

I don't keep very good track of these things, though, and it's also possible 
that I've broken it recently by adding dependencies.  If you try it and files 
seem to be missing, send me a list and I'll fix and retest.

___

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

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


Remove icon animation

2010-10-21 Thread gMail.com
Hi,
when you remove an icon from the Dock you get an animation "fuff" and a
sound. Well, in some of my works I reproduced the same functionality, but I
can't recall which project it was. I unsuccessfully searched on the web too.
Nothing. I even recall that the sound was an OS resource. And the animation
too, it came for free. Do you know how to do that? I am sure that if you
tell me the name of the sound/animation I will find my project with
spotlight. I know, I should fix up my own memory... :-)

--
Leonardo


___

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

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


Re: Remove icon animation

2010-10-21 Thread Gideon King

NSShowAnimationEffect(NSAnimationEffectPoof, [NSEvent mouseLocation], 
NSZeroSize, NULL, NULL, NULL);


Gideon




On 22/10/2010, at 8:43 AM, gMail.com wrote:

> Hi,
> when you remove an icon from the Dock you get an animation "fuff" and a
> sound. Well, in some of my works I reproduced the same functionality, but I
> can't recall which project it was. I unsuccessfully searched on the web too.
> Nothing. I even recall that the sound was an OS resource. And the animation
> too, it came for free. Do you know how to do that? I am sure that if you
> tell me the name of the sound/animation I will find my project with
> spotlight. I know, I should fix up my own memory... :-)
> 
> --
> Leonardo
> 

___

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

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


[NSImage] Bug in System Preferences?

2010-10-21 Thread Iceberg-Dev

I'm currently playing with a screen saver.

Problem:


It draws correctly in fullscreen mode or in SaverLab but does not in  
the preview mode of the 'Desktop & Screen Saver' pane of the System  
Preferences.


Basically, in #fail mode, it draws the first frame and then does not  
refresh.


It works on Mac OS X 10.4 but does not on Mac OS X 10.5 and 10.6.

Details:


An animation frame is drawn in - [ScreenSaverView animateOneFrame] by  
drawing a NSImage using the - drawInRect:fromRect:operation:fraction:  
method.


The NSImage contains one bitmap representation. I have access to the  
buffer of the bitmap representation and I update it for each new frame.


What I've checked:
--

o The problem is not with the size of the preview view, it works fine  
with this size, I tested it in SaverLab and in a custom Screen Saver  
testing app.


o The problem is not with the NSRect parameters passed to the  
drawInRect:fromRect:operation:fraction: method. I've traced their  
values in gdb.


o The problem is not with the bytes buffer not being updated, I  
checked in gdb that the values were correctly updated.


o The problem is not with the view not being refreshed. I draw a  
rectangle with an increasing lighter color (for testing purpose)  
before calling the drawInRect:... method and the rectangle color is  
correctly updated.


Where I think the problem lies:
---

There must be some kind of (annoying here) optimization made by the  
Cocoa APIs. Since this works in fullscreen mode, it must be an  
optimization not enabled in fullscreen mode (and which was not in Mac  
OS X 10.4).


QUESTION:
-

What can be done to address this behavioral incoherence in System  
Preferences?







Code snippet:
-

Here is how the NSImage and NSBitmapImageRep are created (self is a  
NSView subclass instance):


imageRect_=[self bounds];

realWidth_=(((unsigned long) floor(imageRect_.size.width))/ 
DIVIDER)*DIVIDER;


origin_=imageRect_.origin;

origin_.x=origin_.x+((unsigned long) (imageRect_.size.width- 
realWidth_))/2;


imageRect_.size.width=realWidth_;

pixelHeight_=imageRect_.size.height;

imageRep_ = [[NSBitmapImageRep alloc]  
initWithBitmapDataPlanes:NULL
pixelsWide:  
realWidth_
pixelsHigh:  
imageRect_.size.height

bitsPerSample:8
 
samplesPerPixel:4

hasAlpha:YES
isPlanar:NO
 
colorSpaceName:NSDeviceRGBColorSpace

bytesPerRow:0
bitsPerPixel:0
];
buffer_=[imageRep_ bitmapData];

image_=[[NSImage alloc] initWithSize:imageRect_.size];

[image_ addRepresentation:imageRep_];
___

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

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


Remove icon animation - Found

2010-10-21 Thread gMail.com
Forget. I have found it.
I searched for the sound I recalled "fuff" and I found "poof" then I
searched for "animation poof" and I found "NSAnimationEffectPoof", then

NSShowAnimationEffect(NSAnimationEffectPoof, [NSEvent mouseLocation],
NSZeroSize, NULL, NULL, NULL);


--
Leonardo


___

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

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


[NSArray filteredAraryUsingPredicate:] performance?

2010-10-21 Thread Abhi Beckert
Hi,

I have this code:

- (NSArray *)products
{
if (products)
return products;

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"visible = 
1"];
products = [[self.category.products allObjects] 
filteredArrayUsingPredicate:predicate];

return [products retain];
}

I'm using the result of this method to populate a UITableView, and in this case 
— don't need to worry about performance or memory consumption — as there won't 
ever be many products per category. This is nice simple code — much simpler 
than the NSFetchedResultsController code I'm using elsewhere (where the 
UITableView might contain a lot of data).

My question is, at what point do I decide to swap between a simple array of 
objects and a full fetched results controller? How much does performance/memory 
suffer from using filteredArrayUsingPredicate? My time is billed by the hour, 
and we have trouble finding skilled programmer staff in our regional city, so 
anywhere I can save 20 minutes will translate into real benefits to our clients 
(in terms of price and completion times, and even whether or not we will take 
on their project at all).

- Abhi___

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

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


Re: [NSArray filteredAraryUsingPredicate:] performance?

2010-10-21 Thread Graham Cox

On 22/10/2010, at 2:19 PM, Abhi Beckert wrote:

> in this case — don't need to worry about performance or memory consumption — 
> as there won't ever be many products per category.

> How much does performance/memory suffer from using 
> filteredArrayUsingPredicate?

You state it doesn't matter, then you worry that it might.

With any question about optimisation, the question can only be answered by 
measuring the performance to see if it falls short of your requirements or not. 
Since you don't say what your requirements are and have not measured the 
performance against them, nobody can answer this.

All I will say is that on Mac (as opposed to iOS) filtering using a predicate 
is "fast enough" up to many thousands of objects and I've found it adequate for 
my needs, but YMMV. You'd probably be unable to match its performance by doing 
the filtering yourself, though you could beat it by changing your storage so 
that it is organised into sets that already match certain criteria. Also, as 
you're caching the result you'll only get hit once or whenever the predicate or 
content changes.

--Graham


___

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

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


GestureRecognizer puzzle.

2010-10-21 Thread David Rowland
In my iPhone app I use beginTrackingWithTouch, etc. to handle a swipe and 
rotate an OpenGL object. I wanted to add pinch and rotate gestures to do the 
obvious things. I created a UIRotationGestureRecognizer and a 
UIPinchGestureRecognizer, added them to the control view and wrote the action 
methods. They worked just fine.

Then I realized that they operated exclusively. That is, once a rotation was 
recognized a pinch would not be recognized until the touch set was ended and 
another begun. The delegate method 
shouldRecognizeSimultaneouslyWithGestureRecognizer is there to let you specify 
that both should be handled, so I wrote one that simply returns YES.

That also works, but I see an odd behavior. The app works normally until I do a 
pinch-rotate. From then on all touches seem to be greatly delayed, a 
significant fraction of a second. Does the "simultaneous" method invoke 
something that hangs around and impedes touches?

thanks for any comments,

David

___

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

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


Re: [NSArray filteredAraryUsingPredicate:] performance?

2010-10-21 Thread Abhi Beckert

On 2010-10-22, at 1:32 PM, Graham Cox wrote:

> On 22/10/2010, at 2:19 PM, Abhi Beckert wrote:
> 
>> How much does performance/memory suffer from using 
>> filteredArrayUsingPredicate?
> 
> You state it doesn't matter, then you worry that it might.
> 
> With any question about optimisation, the question can only be answered by 
> measuring the performance to see if it falls short of your requirements or 
> not. Since you don't say what your requirements are and have not measured the 
> performance against them, nobody can answer this.

I should clarify I did test the performance in this case, and it's pretty much 
instant.

But I want to make educated guesses about fetch techniques in future, rather 
than spend precious billable time testing every single case, only to find out I 
need to spend three hours refactoring my code. I've been doing things like this 
in PHP/MySQL for years and am used to knowing, before I write the code, what 
technique will deliver "good enough" performance while minimising bugs 
(optimisation is the root of all evil!). We've only recently started offering 
cocoa programming to our clients.

> All I will say is that on Mac (as opposed to iOS) filtering using a predicate 
> is "fast enough" up to many thousands of objects and I've found it adequate 
> for my needs, but YMMV. You'd probably be unable to match its performance by 
> doing the filtering yourself, though you could beat it by changing your 
> storage so that it is organised into sets that already match certain 
> criteria. Also, as you're caching the result you'll only get hit once or 
> whenever the predicate or content changes.

Thanks, that pretty much answers my question. Thanks! :-)
- Abhi___

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

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


how to stack two views vertically (and resize properly)

2010-10-21 Thread Wayne Shao
Hi,

I have this layout:   A container view C, with two sub-views in vertical
order: a Box B on the top, and a WebView W at the bottom.

Box B
---
WebView W


In IB, I set the following resize property:

B: fixed top edge and fix height, take whole width of the parent
W: fixed bottom, fix top position, let it take the full size of both x and y
direction of the parent.

The problem: When the parent view C is resized to a very small height, the
WebView W's top edge goes over the Box on the top, making the Box invisible.
When C is resize to full height, the W still covers the Box.
I do not want the top edge of W to move.

The  question is: how do I let the WebView W's top edge stick with B's
bottom edge? (B fixed height, and W - variable height upon resize)

Thanks,
-- 
W. Shao
___

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

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


Re: how to stack two views vertically (and resize properly)

2010-10-21 Thread Kyle Sluder
On Thu, Oct 21, 2010 at 10:10 PM, Wayne Shao  wrote:
> Hi,
>
> I have this layout:   A container view C, with two sub-views in vertical
> order: a Box B on the top, and a WebView W at the bottom.
>
> Box B
> ---
> WebView W
>
>
> In IB, I set the following resize property:
>
> B: fixed top edge and fix height, take whole width of the parent
> W: fixed bottom, fix top position, let it take the full size of both x and y
> direction of the parent.
>
> The problem: When the parent view C is resized to a very small height, the
> WebView W's top edge goes over the Box on the top, making the Box invisible.
> When C is resize to full height, the W still covers the Box.
> I do not want the top edge of W to move.
>
> The  question is: how do I let the WebView W's top edge stick with B's
> bottom edge? (B fixed height, and W - variable height upon resize)

It sounds like you're letting B get squished to zero height.

Set a minimum height for your window that prohibits the layout from
getting screwed up.

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

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