Posts

Showing posts with the label cocoa

Problem avoiding first responder on a NSTextField

Image
Problem avoiding first responder on a NSTextField I need to change behavior of input fields in a really simple app: Whenever i launch the application the first text field get the focus, but i don't want this behavior. I tried checking "Refuses first responder" in IB. It works but with this option checked i can't move between input fields pressing "tab" button. What can i do to avoid focus at startup and keep the ability to move with tab keyboard button ? Not really an answer since i didn't tried it on MacOS, but on iOS I would use [textfield resignFirstResponder] on load. – Valentin Radu Aug 11 '11 at 11:02 @mindnoise nothing to do, it still maintains focus. – MatterGoal Aug 11 '11 at 12:17 ...

How to rotate NSButton in clockwise direction from its center point in Cocoa?

Image
How to rotate NSButton in clockwise direction from its center point in Cocoa? I want to set animation for NSButton in my mac application. I followed the below link for the same, but below code is working for iOS, not for Mac. How to rotate a flat object around its center in perspective view? What I want to achieve: Basically, I want to rotate an image clockwise from the center point of the image just like the above code works for iOS. Issue currently having: In Mac app, the image is rotating from its corner point, not from the center. CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.fromValue = [NSNumber numberWithFloat:0]; animation.toValue = [NSNumber numberWithFloat:2 * M_PI]; animation.duration = 1.0; animation.repeatCount = INFINITY; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; [btnScan setWantsLayer:YES]; [btnScan.layer addAnimation:an...