ios6

How to restrict a moveable view by Pan gesture

会有一股神秘感。 提交于 2019-12-30 06:33:29
问题 I have a UIImageView which is moveable via a pan gesture. UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; [self.photoMask addGestureRecognizer:pan]; I would like to restrict the area this can be moved on screen. Rather than the user be able to drag the view right to the side of the screen, I want to restrict it by a margin of some sort. How can I do this? Also, how is this then handled when rotated? EDIT --- #pragma mark -

Facebook SLComposeViewController URL shows up in body if both URL and image present

故事扮演 提交于 2019-12-30 06:05:21
问题 Using SLComposeViewController , I notice curious behavior when posting to Facebook if both the image and the URL are present. Specifically, if you have both image and URL, the URL appears in the body of the Facebook post in the view of the SLComposeViewController , immediately after the initialText if I do the following: SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; NSString *text = @"This is a test Facebook post

Change the text of an attributed UILabel without losing the formatting?

北战南征 提交于 2019-12-30 05:41:07
问题 In the storyboard I layout a set of labels with various formatting options. Then I do: label.text = @"Set programmatically"; And all formatting is lost! This works fine in iOS5. There must be a way of just updating the text string without recoding all the formatting?! label.attributedText.string is read only. Thanks in advance. 回答1: An attributedString contains all of its formatting data. The label doesn't know anything about the formats at all. You could possibly store the attributes as a

Saving to/getting JPEG from user gallery without recompression

十年热恋 提交于 2019-12-30 03:25:08
问题 I am trying to find a way to read and write JPEG images to user gallery (camera roll) without iOS re-compressing them. UIImage seems to be the bottleneck here. The only method for saving to user gallery I've found is UIImageWriteToSavedPhotosAlbum(). Is there a way around this? For now my routine looks like this –Ask UIImagePickerController for a photo. And when it didFinishPickingMediaWithInfo, do: NSData *imgdata = [NSData dataWithData:UIImageJPEGRepresentation([info objectForKey:@

How do I create a custom view class Programmatically? [closed]

こ雲淡風輕ζ 提交于 2019-12-30 03:01:06
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . I want to create a very simple customView with a few UIlabel on it, How should i do this . any tutorial or suggestion would be appreciated . I am new to this , didn't try before. I tried this with xib. @interface MyCustomView : UIView @property (strong, nonatomic) IBOutlet UILabel

iOS 6 app crashes in EAGLContext when displaying maps

强颜欢笑 提交于 2019-12-30 02:30:14
问题 We have an app that uses OpenGL and MKMapView . When we switched to iOS 6 it started crashing at [EAGLContext setCurrentContext:] with EXC_BAD_ACCESS whenever we tried to display a map after setting our own EAGLContext . 回答1: iOS 6 maps are OpenGL based. Your app will crash if you don't call [EAGLContext setCurrentContext:nil] after you have set your own EAGLContext. We fixed our bug by putting the above call into the dealloc method of our class that was interacting with EAGLContext. 来源:

Storyboard + base localization + .strings file does not localize at runtime

江枫思渺然 提交于 2019-12-30 02:01:05
问题 (There are similar questions. Some resulted in answers that I've tried and found not to work. Others got no answers, I assume because the querents didn't supply as much detail as I'm about to.) I started with a storyboard that worked well for my app; the strings it contains are in English. I wanted to add a French localization. I did this: Added a base localization, which transferred MainStoryboard.storyboard from en.lproj to Base.lproj . Added a French localization, which cloned InfoPlist

How to deal with inconsistent Chinese maps on iOS 6?

醉酒当歌 提交于 2019-12-30 01:37:27
问题 For Chinese maps on iOS 6, it seems that MapKit selects map provider based on your where the device is located. If you're in China it will use AutoNavi maps, and else it will use the default Apple maps. To complicate things, the AutoNavi maps seem to be transformed in the same way that Google's maps on iOS 5 are, whereas the default Apple maps are not transformed. By transformed I'm talking about the fact that all maps in China are transformed, although this is not true. Rather, some maps in

iOS 6 auto rotate confusion

纵饮孤独 提交于 2019-12-30 01:31:07
问题 I have my entire interface in one Storyboard. How can I make most of the ViewControllers only support a portrait orientation while only a couple supporting all orientations. I can't understand apples new auto rotate system. Also, how can I make this backwards compatable to iOS 5? 回答1: In your Navigation Controller subclass, forward the decision to the top view controller in the stack: -(NSUInteger) supportedInterfaceOrientations { return [self.topViewController supportedInterfaceOrientations]

Using presentViewController from UIView

北城余情 提交于 2019-12-29 17:43:00
问题 I am creating a title bar for my iOS application and I am making this inside a UIView. The only issue I am having is with the "home button". When the home button is pressed, it needs to go to the home page, which is ViewController. However, it doesn't look as if [self presentViewController:vc animated:NO completion:NULL]; works for UIView. How do I work around this problem ? - (void) createTitlebar { CGRect titleBarFrame = CGRectMake(0, 0, 320, 55); //Create the home button on the top right