Since the iOS9 upgrade, the custom images on my MKPinAnnotationView are no longer showing up. Is there a documented change somewhere?
Per someone from Apple on the developer forums:
MKPinAnnotationView manages its own pin image. If you'd like to set a
custom image, it's best to use MKAnnotationView directly.
From: https://forums.developer.apple.com/thread/3920
I was doing this as well, and a simple switch to use MKAnnotationView worked for me. My guess is this was never supposed to work. I couldn't find any documentation on an image property for MKPinAnnotationView
Related
I'm debugging a project that was working fine in iOS7.1, but does not lay out it's content properly in iOS 8.0. I've narrowed the issue down to this method:
[self orientRootViewControllerForOrientation:rootViewController.interfaceOrientation];
iOS8 no longer returns correct UIInterfaceOrientation from rootViewController.interfaceOrientation, instead it returns "upside down".
Reading the documentation, I'm confronted with a cryptic message:
Use viewWillTransitionToSize:withTransitionCoordinator: to make
interface-based adjustments.
Reading documentation on UIViewControllerTransitionCoordinator, I don't see it having any properties. How can I modify my method that expects an interface orientation to get it's orientation from UIViewControllerTransitionCoordinator?
Basically you are supposed now to layout your content based on the available size, no more on the rotation. Which results in big pains to support older rotation-based code.
The view controller transition coordinator provides a UIViewControllerTransitionCoordinatorContext that has a rotation factor. This could give you the hint you need ?
This blog post mentions this too.
You also have the usual device ([UIDevice currentDevice].orientation) or status bar orientation.
In case you are working on iOS 6 rotation methods, this post has relevant informations too.
I was following a tutorial on how to build a custom picker with an UIPickerView in Sams Teach Yourself IOS6 Application Development in 24 hours and I've noticed that simply returning an UIImage in (UIView*)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view method of the UIPickerViewDelegate does not work properly: the images do not appear correctly (they rotate on the spinning wheel but for example they disappear when they should move over the current selection's row). I've found a solution at this link on Stack Overflow and it effectively works, but I'd like to know if this strange behavior appeared in IOS 7 is due to a new way of using UIPickerView or if it is more a sort of bug.. I did not find anything useful in the official API Reference docs. Is there any official doc that is talking about the change in how we must return an UIImageView to be used in a UIPickerView
It looks like the answer is 'No'. I also looked through the Release Notes for 7.0 & 7.1 and looked at the differences in the references for UIPickerView, UIPickerViewDelegate, and UIView (among others) and couldn't find anything do explain why it behaves this way now and I couldn't find any changes to UIPickerView or anything it inherits from or conforms to that would explain it. (If there is something there that explains it then it was not immediately obvious to me.)
As far as I know, those are the only places that would have any official information on this.
I think the only way to know for sure whether this is deliberate or a bug is to report it.
I have an NSOutlineView and a stack of objects, you can imagine it is a tree of files.
So I tried to extend the NSTextFieldCell class to parse the name of the current item and render an icon for it. But I am still stuck in the icon part. I simply can't get a standard-hardcoded-image to work!
I tried many tutorials, the only one I got to work is a class called PXSourceList, but it was designed for OSX 10.7+. Also the majority of these tutorials use AppDelegate with the NSOutlineViewDataSource protocol and I also want the code to be managed elsewhere, not in the APPDelegate class.
Can someone give-me some directions on the first steps? I think a bit of enlightenment on how the general logic surrounding the icon thing would be enough. I appreciate!
I use XCode 4.2 for Snow Leopard. The project I'm on is supposed to work in OSX 10.6+, so I can't use the new Lion approach of cells using NSViews.
You can get the file icon from its path as follows;
NSImage *iconImage1 = [[NSWorkspace sharedWorkspace] iconForFile:filepath];
You need an image cell to display the icon image.
I'm trying to use the ZBar SDK to create an embedded QR Code reader just like shown in the example here: https://github.com/twotoasters/zbar (the Embeded Reader example)
The only difference is that I'm using it in storyboards. I tried copying the code into my application and everything seems to be fine, until I actually try to use it.
I'm working on a simulator, so the ZBarCameraSimulator is initializing and showing it's text, but when I try the "two finger click" (checked the Multitouch Option in the Subview attributes) it seems to ignore the action.
I guess there is a delegate or a handler missing, which was not required in with XIBs but is necessary within the Storyboards.
Anybody got any clues? Would be thankful.
Ok, looks like I found the solution,
I was assuaging the readerView to a (weak, nonatomic) IBOutlet property, while the XIB project used "retain" option. I changed the option to strong (as what I understand from ARC, retain shouldn't be used with it) and it started working.
I am also using this with storyboard and have had no trouble having the simulator recognise the two finger click. I do this by pressing Option+Mouse and holding it for a second.
I do however have follow on issues where the scanned image does not seem to be processed, but I think that my be due to a delegate issue.
Greetings! I'm attempting to use MKMapView without any Apple code samples, though there are a few others out there of varying clarity. (I know, "Read the friendly manual." I've done that but it's not 100% clear, so please bear with me on this one.)
Here's the situation. I have a MKMapView object, wherein I have added a set of about ten MKPinAnnotation objects. So far, so good. Everything is alloced/released sanely and there doesn't appear to be any complaints from Instruments.
Upon initial display, I set up a MKCoordinateRegion object with the centerpoint at our first pin location, and a (arbitrary) span of 0.2 x 0.2. I then call:
[mapView setRegion:region animated:YES];
[mapView regionThatFits:region];
Wow! That worked well.
Meanwhile ... I also have a segmented control to allow for movement to each pin location. So as I tap through the list, the map animates to each new pin location with a new pair of calls to setRegion:animated: and regionThatFits: ... or at least that's the idea.
While the map does "travel" to the new pin location, the map itself doesn't update underneath. Instead, I see my pin on a gray/blank-map background ... until I nudge the map in any direction, however slightly. Then the map shows through! (If I'm only moving within a short distance of the previous pin location, I'll usually see whatever part of the map was already loaded.)
I suspect I'm doing something dumb here, but I haven't been able to figure out what, at least not from the MapKit docs. Perhaps I'm using the wrong calls? (Well, I do need to set the region at least once, yes? Moving that around doesn't seem to help though.) I have also tried using setCenterCoordinate:animated: - same problem.
I'm assuming nothing at this point (no pun intended). Just trying to find my way.
Clues welcome/appreciated!
UPDATE: Calling setRegion:animated: and regionThatFits: the first time, followed by setCenterCoordinate:animated: while traversing the list, has no effect. Interesting finding though: If I change animated to NO in both cases, the map updates!!! Only when it's set to YES. (Wha happen?! Is animated: broken? That can't be ... ???)
It turns out that the map update doesn't work when using the SIMULATOR. When I try setCenterCoordinate:animated: on the device, I do get the map update underneath.
Bottom line: I was trusting the simulator to match the device in terms of map updating behavior. Alas, I was mistaken! Lesson learned. "Don't let this happen to you." :)
You need to invoke the setRegion:animated: call in the Main thread context.
Just do something like:
....
[self performSelectorOnMainThread:#selector(updateMyMap) withObject:nil waitUntilDone:NO];
}
-(void) updateMyMap {
[myMap setRegion:myRegion animated:YES];
}
and it should work in any case (animated or not), with the map updated underneath.
Hum strange. The map updates on my Mac even in the simulator. Maybe a network setting (proxy or whatever) that would prevent the map widget to download the tiles on the simulator ?
Even though this is an old topic I thought I'd ring in with my experience. It seems the map animation only fails on devices running iOS 3.1.x and the simulator running 3.1.x. My dev iPod touch with 3.1.3 fails to zoom if animation is on.