ios6

Unwanted Vertical Padding from iOS 6 on CATextLayer

烂漫一生 提交于 2019-12-03 03:50:20
Background: I started my project in iOS 5 and built out a beautiful button with layer. I added a textLayer onto the button and center it using the following code: float textLayerVerticlePadding = ((self.bounds.size.height - fontSize) /2); textLayer = [[CATextLayer alloc]init]; [textLayer setFrame:CGRectOffset(self.bounds, 0, textLayerVerticlePadding)]; It works great and looks dead center until iOS 6. Problem: iOS 6 added a space (padding) between the topmost bound and the text in textLayer. This upsets the calculation above. Is there a way to make sure that iOS 6 does not? because I would

iOS: get video duration and thumbnails without playing video

亡梦爱人 提交于 2019-12-03 03:49:44
问题 I need to get a (local) video's duration, and then get access to its individual frames as UIImage s. So far I've been using MPMoviePlayerController for this. First I register for MPMovieDurationAvailableNotification events, and then call prepareToPlay . When the event is received I note the video's duration, and then I request frames via requestThumbnailImagesAtTimes . This works, however the video seems to start playing even if I have not added the it to the view in any way (I can hear the

How get feedback from APNs when sending push notification

≡放荡痞女 提交于 2019-12-03 03:44:59
Now I can send push Token from device that has installed a pass already, but I don't know how the feedback work in this point. From apple docs, Apple Push Notification service (APNs) provides feedback to server to tell if pushToken is valid or not. How to get this feedback ? I try this code, but a lot errors. This is the code: <?php $cert = '/Applications/MAMP/htdocs/passesWebserver/certificates.pem'; $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', $cert); stream_context_set_option($ctx, 'ssl', 'verify_peer', false); $fp = stream_socket_client('ssl:/

iOS 7 status bar translucency with backwards compatibility

空扰寡人 提交于 2019-12-03 03:43:43
I built my app to have a translucent navbar in iOS 6. I'd like to utilize the translucent status bar in iOS 7 and keep the app as is in iOS 6, but my content is always underneath the status bar in iOS 7, with 20px missing on the bottom. I figure that I can make the very tedious code changes that check whether the device has iOS 7 and then adjust my content accordingly, but I fear that this is going to be a lot of work. Ideally, I'd like to add 20px of padding to the top of every view controller's view, so that the content shifts down, and still functions fine with an opaque navbar on iOS 6. I

UIKeyboard avoidance and Auto Layout

我的梦境 提交于 2019-12-03 03:41:50
问题 Given the focus on Auto Layout in iOS 6, and the recommendation by Apple engineers ( see WWDC 2012 videos ) that we no longer manipulate a views' frame directly, how would one go about avoiding the keyboard using only Auto Layout and NSLayoutConstraint? Update This looks like a reasonable solution: An example of keyboard sensitive layout (GitHub source) but one potential issue I see is what happens when a user rotates the device and the keyboard is already on screen? 回答1: My idea is to create

AVFoundation audio processing using AVPlayer's MTAudioProcessingTap with remote URLs

故事扮演 提交于 2019-12-03 03:35:24
There is precious little documentation on AVAudioMix and MTAudioProcessingTap, which allow processing to be applied to the audio tracks (PCM access) of media assets in AVFoundation (on iOS). This article and a brief mention in a WWDC 2012 session is all I have found. I have got the setup described here working for local media files but it doesn't seem to work with remote files (namely HLS streaming URLs). The only indication that this is expected is the note at the end of this Technical Q&A : AVAudioMix only supports file-based assets. Does any one know more about this? is there really no way

iOS 6.0: UICollectionView doesn't respect clipsToBounds with pagingEnabled

半腔热情 提交于 2019-12-03 03:23:52
Background I am implementing a UICollectionView (for the first time) in an effort to achieve a paged horizontal scroll view of tiles. I'd like each tile to show in the center of the frame with it's sister tiles partially visible to the left and right (something like the page selector in the Safari app). I'm interested in using the UICollectionView to take advantage of built-in cell dequeueing and would rather not use a rotated UITableView . Issue The issue I'm finding is that when using pagingEnabled = YES and clipsToBounds = NO , the UICollectionView removes cells outside the collectionView

iOS: UIPasteboard setImage: fails on iOS6 and/or Xcode 4.5

孤人 提交于 2019-12-03 03:20:30
Update: Added bug 12408800 on Apple's site. I am copying some one or multiple UIImage to the UIPasteboard, and it's been working like gangbusters.. until my phone upgraded to iOS 6. Xcode 4.5 with iOS 5.1 - OK Xcode 4.4 with iOS 6.0 - Also OK ( according to this post ) Xcode 4.5 with iOS 6.0 - FAIL (also tested distributing via TestFlight, for what it's worth - still fails) Here's my code (super basic, etc): // add image to clipboard UIImage *image = [[UIImage imageNamed:@"testimage"]; [[UIPasteboard generalPasteboard] setPersistent:YES]; [[UIPasteboard generalPasteboard] setImage:image]; And

Load different Storyboard for iPhone 5 @ app start

孤者浪人 提交于 2019-12-03 03:00:01
I am using the following code in my AppDelegate.m to detect which device the user is using: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { CGSize result = [[UIScreen mainScreen] bounds].size; if(result.height == 480) { NSLog(@"iPhone 3,5 Inch"); [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil]; } if(result.height == 568) { NSLog(@"iPhone 4 Inch"); [UIStoryboard storyboardWithName:@"iPhone5-storyboard" bundle:nil]; } } return YES; } But when I build

how to disable auto layout by default for xcode 4.5?

给你一囗甜甜゛ 提交于 2019-12-03 02:50:33
A question here: Xcode 4.5 corrupting XIBs? illustrates the problem and solution for xcode 4.5 creating nib files that can not run on ios5. Does anyone have a solution to prevent the auto layout checkbox from being defaulted to on? I'm worried that in the process of development, I will forget to unchecked that box. There's a way, but it's kinda convoluted and, I might add, not recommended. You can open your template files located in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates/User Interface/ , in each directory, there