Zoom in and Out through a NSView or Magnify - objective-c

I am hoping to be able to make something similar to the universal access zoom window shown below. I have already created an NSView and using a fill operation I made a rect with a clear "see through" composite to see through my window and show the desktop. Now I am wondering if it is possible to zoom in and out inside my view just like the picture below. I was thinking this might be an IkImageView or something I could apply but i wasent sure how it was done. Does anyone know how to do this or show me where I could find this in the docs? Some code would be great. Thanks!

Take a look at Apple's example CIAnnotation. In this example is magnifying image but I think You can achieve what You want. You can download sample code from here.
CIAnnotation app example:
References and guides which can help You with this:
Core Image Programming guide
Quartz 2D Programming Guide
NSGraphicsContext Class Reference

NSView supports zoom through - (void)scaleUnitSquareToSize:(NSSize)newUnitSize
This zooms the content of the view, so to use this you would have to set the Desktop behind the mouse as view content (NSImage maybe?) and then zoom the view. It will have to update when the mouse is dragged.
Check the ImageKit part of Quartz, in particular the class IKImageView. It has zoom features, but I have not worked with it myself yet.

Related

MKMapview: How to get moving directions of current location pin?

I am working in a maps related application. In my application I would like to display destination pin and current location pin. On top of this I need to display an image like 'arrow' which should display moving direction of the user. Can anyone suggest me how do I achieve this.
Thanks
If I understand you correctly you want something like an arrow pointing which way they are moving, so grab the heading, and draw an overlay image on the map of the arrow. Then have it update the overlay when the heading changes.
documentation here: https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40008772
https://developer.apple.com/library/ios/documentation/userexperience/Conceptual/LocationAwarenessPG/AnnotatingMaps/AnnotatingMaps.html#//apple_ref/doc/uid/TP40009497-CH6-SW1
also this might help:
MKOverlayRenderer to display UIImage over map view

How to control the Appearance of UIPickerView

Can anyone point me in the right direction here.
Im trying to use a UIPickerView that is displaying images.
The images are too big for the default pickerview setup so I was wondering how I could control how big the rows in the UIPickerView are and how wide the translucent selection bar is to accomodate for their custom size.
Can anyone provide some guidelines as to how big I should make the row images or where a good tutorial / book chapter is on this?
Thanks!
Why not use the UIImagePickerController instead of trying to customize a UIPickerView? It is designed to enable you to allow the user to pick from their library of images if you use the sourceType of UIImagePickerControllerSourceTypePhotoLibrary.
There is sample code on how to use this controller at http://zcentric.com/2008/08/28/using-a-uiimagepickercontroller/
If the images are not from the user's library, then I would suggest you scale the images down to fit the constraints of the UIPickerView, or use a tabelView with the images laid out in it for the user to select.

Programmatically resizing and Scrolling NSView after application launch

I want to create a simple application which performs some calculations and then draws some images on view. I use NSBezierPath. Then I must resize the view and allow people scroll the finished picture. But i don't know how.If I also try to draw an image on an invisible part of canvas then it becomes invisible or isn't drawn (I couldn't know the future canvas size).
Check out the Apple sample code called BezierPathLab. I think that will get you started. There's lot of other sample code for Quartz 2D drawing too.
Being able to scroll and resize the view should be as simple as putting the view that you will be using to draw inside an NSScrollView.

Simple slideshow in a UIImageView

I got trouble to add slideshow to my application.
Currently, I have a UIView composed of a segmentedControl.
I made ​​two "views" that I hide or display depending on the selected button.
I'm looking to make a simple slideshow in one of my two views. I made a UIImageView because it is simple to display pictures.
So I'd like to display my pictures one by one and it is possible to move from one image to another by sliding your finger to the right or left (just as in the native app "Photos").
I tried to adapt example codes from the documentation, but without succes.
So I'ml looking for help.
Thanks,
jb crestot
SO, I've actually done this and it's fairly easy. The ingredient that you are missing is a UISCrollView. My implementation did exactly what you describe (allow the user to go back and forth between a set of images).
Basically, add a UIScrollView to your View in interface builder and you will be creating the UIImage views with code (a simple for loop) and setting their images the same way. I did this safely with no memories issues with about 15 images (PNG's). There could be a potential performance issue with this message if you are working with a large number of images (say 40?)
I hope this helps, let me know if you need a code sample to see how this works.
You may consider using a custom class, such as iCarousel, linked below. Each of these views could be your image, and then tapping on them could launch a fullscreen view for example.
Keep us posted!
http://cocoacontrols.com/platforms/ios/controls/icarousel
See apple's page control sample application.

Rotating MapView according to compass

I'm working on Map application that needs to work like original MapView on iOS.
I need to rotate mapview according to compass heading value. I tried MTLocation example also I also tried this answer But my results is not good.
Please see the screen shot.
When I rotate mapview according to heading value Map is rotating but as you can see on screen tiles is missing.
How can I solve this display problem ?
Regards
- Fatih
Hy,
I'm the author of MTLocation. Thanks for using it by the way!
For this to work you have to make sure, that your MKMapView is a subview of your ViewController's view (and not the view itself). Then you have to increase the frame of your mapView with a simple Pytaghoras - calculation: the width and height must be at least as big as the diagonal: sqrt(visibleWidth[320]^2 + visibleHeight[480-88]^2) = 506.
So that means
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(-100,-100,520,520)];
Hope that helped, please consider upvoting if it fixed your problem.
You can consider using a bigger frame for the MKMapView object. It should probably be a square with each side equal to the length of the device's diagonal. The problem with this approach is that there are regions of this object that the user won't see but we process information like views for annotations related to that region anyway. Other properties like visibleMapRect would be least helpful.
Another alternative would be to be zoom in by scaling the MKMapView object on rotation. But this might make the map blurry (untested). You could zoom out on the region displayed in the map but it could lead to frequent refreshes. You can look at a middle ground where you don't zoom out until the map is rotated over a certain angle. You can also look at using two views where one of the views is off screen and updated so that it can replace the view after a certain amount of rotation so that it feels seamless.
I am working towards making my own maps application in iPhone. I want my maps to rotate as the user turns. I tried setUserTrackingMode available in iOS 5, but due to some reason it doesn't work. So I decided to take help of MTLocation framework here.
Till now I have done the following.
created a new project and copied all .m and .h files in that.
Import MapKit.h and MTLocation.h.
In Viewcontroller.h, defined property for mapView (should I define a property for locateMeItem).
In ViewDidLoad, paste the code given at the end of the page here.
I get a few errors:
Can't see the locateMe button when created programatically.
Undefined property headingEnabled.
myCustomSelector has no effect.
self.toolbar- toolbar is not a instance of ViewController.
I have tried a code at gist[dot]github[dot]com/1373050 too, but I get similar errors.
Can anybody explain a detailed procedure of this.