working on it ...

Filters

Explore Public Snippets

Sort by

Found 101 snippets matching: ios7

    public by marksimon232 modified Jun 23, 2014  5359  8  6  3

    Base64 Decoding in iOS 7+

    Do you have Encoded text(NSString) using NSData Class new API which is Added in iOS7?
    Objective-C
    
    NSString *plainString = @"foo";
    Encoding
    
    NSData *plainData = [plainString dataUsingEncoding:NSUTF8StringEncoding];
    NSString *base64String = [plainData base64EncodedStringWithOptions:0];
    NSLog(@"%@", base64String); // Zm9v
    Decoding
    
    NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:base64String options:0];
    NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
    NSLog(@"%@", decodedString); // foo 
    Swift
    
    let plainString = "foo";
    Encoding
    
    let plainData = (plainString as NSString).dataUsingEncoding(NSUTF8StringEncoding)
    let base64String = plainData.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.fromRaw(0)!)
    println(base64String) // Zm9v
    Decoding
    
    let decodedData = NSData(base64EncodedString: base64String, options: NSDataBase64DecodingOptions.fromRaw(0)!)
    let decodedString = NSString(data: decodedData, encoding: NSUTF8StringEncoding)    
    println(decodedString); // foo 

    external by Apisit Toompakdee modified Jun 30, 2013  197399  1  4  0

    Remove that 1px line from UINavigationBar in iOS7

    Remove that 1px line from UINavigationBar in iOS7: gistfile1.m
    [self.navigationController.navigationBar.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        if ([obj isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]){
            UIView* v = obj;
            [[v.subviews objectAtIndex:1] removeFromSuperview];
           *stop=YES;
        }
    }];
    
    
    

    external by roachhd modified Sep 29, 2014  9  0  1  0

    My read me file md to html for iOS7 CSS UI kit on Github From http://roachhd.github.io/ios7-css-ui/

    My read me file md to html for iOS7 CSS UI kit on Github From http://roachhd.github.io/ios7-css-ui/: index.html
    <p>Thank you for checking out my UI kit. </p>
    <p>To compile with Sass, run the following command: sass —update scss:css </p>
    <p>If you have any questions, feel free to email me at: <a herf="mailto:katie@roachhd.com">my email</a>.</p>
    <p>Happy coding!</p>
    <p><a href="http://test.roachhaus.com/test/2013/ios7-css-ui/">My Demo</a></p>
    <p><a href="http://roachhd.github.io/ios7-css-ui/">Github Pages</a></p>
    <p>Please give it a STAR or FORK it and make it better!</p>
    
    

    external by designerJordan modified Sep 22, 2014  125  0  2  0

    HLS Alternate Audio Tracks - iOS7 vs. iOS8

    HLS Alternate Audio Tracks - iOS7 vs. iOS8: HLS-alt-audio-iOS8.md
    # Changes to HLS Alternate Audio Tracks
    **iOS7 vs. iOS8**
    
    Since iOS 8 went live on Friday and I updated a few of my devices over the weekend, I decided to do some quick testing of web video playback. Wanted to see if there were any little, undocumented changes that would affect REPlayer, or our general approach to HTML video - like the changes to exiting fullscreen video that came in the update from iOS6->iOS7<sup>[1](#1)</sup>.
    
    Overall, things seem pretty much the same between iOS7->iOS8, and in a quick runthrough, REPlayer looks to be working just fine.
    
    One interesting change to note though, is that the native interface (iOS default controls used when video is fullscreen) for selecting Sub-Title/CC tracks - or Alternate Audio tracks when they're available -  no longer seems to recognize/display the audio tracks in iOS8.
    
    Sub-Title selection still works just fine, but the Audio Section (and Audio Tracks) do not display in iOS8. Confirmed that the testing m3u8 still contains Alternate Audio tracks in the manifest. Viewing the same video on a device running iOS7 will display, and allow the selection of, both Sub-Title and Audio Tracks, while iOS8 will only display the subtitle tracks.
    
    Off the bat, I'm assuming this is a bug, not a feature, and it will be addressed in future updates, though it could also be a result of the transition from QTKit to AVFoundation as the new iOS Media Framework<sup>[2](#2)</sup>. One other possible cause for the discrepancy, is the different versions of WebKit used between the two<sup>[3](#3)</sup>.
    
    ----
    
    ##### Notes and non sequiturs
    
    
    <h6 id="1">1</h6>
    <small>**In iOS6** - when you switched to fullscreen video, there were 2 options available for exiting fullscreen:
    * One was to tap the "Exit Fullscreen" icon in the lower right side of the control bar (Two arrows on a diagonal that were pointing inwards towards each other - the inverse of the icon used to enter fullscreen)
      * This would exit fullscreen, and maintain the current playback state of the video, i.e., if the video was playing in fullscreen, it would continue to be playing after leaving fullscreen - if the video was paused in fullscreen, it would remain paused after leaving fullscreen
    * The other was to tap on the text-button "DONE" in the upper left of the fullscreen interface
      * This would exit fullscreen and pause the video, regardless of current playback state 
    
    **In iOS7** - the "Exit Fullscreen" icon was removed, and the only option was to use "DONE" - this meant that whenever you exited fullscreen in iOS7, the video would be paused every time. Meaning that an extra tap on the Play Button was necessary in order to resume playback.</small>
    
    <h6 id="2">2</h6>
    <small>AVFoundation was added in iOS 7 and existed alongside QTKit, though developers were strongly encouraged to make the switch - Have not yet found explicit documentation of the status/availability of QTKit in iOS8</small>
    
    <h6 id="3">3</h6>
    <small>
    * User Agent String of an iPhone 5S running iOS __8.0__ reports WebKit _v600.1.4_
      * Full User Agent String -  
        `Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A365 Safari/600.1.4`  
    
    * User Agent String of an iPhone 5S running iOS __7.1__ reports WebKit _v537.51.2_
      * Full User Agent String -  
        `Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53`</small>
    
    

    external by tangyumeng modified Jul 19, 2014  80  0  1  0

    iOS7 适配屏幕

    iOS7 适配屏幕: shipei
    #define IOS7_OR_LATER   ( [[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending )
    
    #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
    	if ( IOS7_OR_LATER )
    	{
    		self.edgesForExtendedLayout = UIRectEdgeNone;
    		self.extendedLayoutIncludesOpaqueBars = NO;
    		self.modalPresentationCapturesStatusBarAppearance = NO;
    		self.navigationController.navigationBar.translucent = NO;
    	}
    #endif
    
    

    external by originell modified Jan 7, 2015  57  0  1  0

    Reliably get the top most UIViewController. Tested with iOS7 and 8

    Reliably get the top most UIViewController. Tested with iOS7 and 8: TopMostViewController.swift
    // Note: There are no fancy error checks in here. This is just meant to quickly demonstrate this.
    // I was extremely frustrated because most posts on stackoverflow are missing the important point
    // of checking for the "presentedViewController".
    
    // If you are working in a view that is *already living* in the view hierarchy.
    var topMostController = view.window!.rootViewController!
    // or
    // If you don't have a view in the hierarchy yet (as it might happen in viewDidLoad etc.)
    // (there is also the possibility to use UIApplication.sharedApplication().keyWindow, though it seems
    //  that the internet's general opinion is that it's safer to use the delegate's window)
    var topMostController = UIApplication().sharedApplication().delegate!.window!!.rootViewController
    // Important: do not forgot to check for this. Presented ViewControllers are in front of others!
    // TODO: Might be necessary to do this recursively?
    if let presentedVC = topMostController.presentedViewController {
        topMostController = presentedVC
    }
    
    
    
    
    
    

    external by Wil Ferrel modified Apr 18, 2015  57  0  1  0

    iOS7 Font Names

    iOS7 Font Names: gistfile1.txt
    2013-09-28 15:54:13.369 iOSFontListTest[3753:60b] Font Family Names (
        "Academy Engraved LET",
        "Al Nile",
        "American Typewriter",
        "Apple Color Emoji",
        "Apple SD Gothic Neo",
        Arial,
        "Arial Hebrew",
        "Arial Rounded MT Bold",
        Avenir,
        "Avenir Next",
        "Avenir Next Condensed",
        "Bangla Sangam MN",
        Baskerville,
        "Bodoni 72",
        "Bodoni 72 Oldstyle",
        "Bodoni 72 Smallcaps",
        "Bodoni Ornaments",
        "Bradley Hand",
        "Chalkboard SE",
        Chalkduster,
        Cochin,
        Copperplate,
        Courier,
        "Courier New",
        "DIN Alternate",
        "DIN Condensed",
        Damascus,
        "Devanagari Sangam MN",
        Didot,
        "Euphemia UCAS",
        Farah,
        Futura,
        "Geeza Pro",
        Georgia,
        "Gill Sans",
        "Gujarati Sangam MN",
        "Gurmukhi MN",
        "Heiti SC",
        "Heiti TC",
        Helvetica,
        "Helvetica Neue",
        "Hiragino Kaku Gothic ProN",
        "Hiragino Mincho ProN",
        "Hoefler Text",
        "Iowan Old Style",
        Kailasa,
        "Kannada Sangam MN",
        "Malayalam Sangam MN",
        Marion,
        "Marker Felt",
        Menlo,
        Mishafi,
        Noteworthy,
        Optima,
        "Oriya Sangam MN",
        Palatino,
        Papyrus,
        "Party LET",
        "Savoye LET",
        "Sinhala Sangam MN",
        "Snell Roundhand",
        Superclarendon,
        Symbol,
        "Tamil Sangam MN",
        "Telugu Sangam MN",
        Thonburi,
        "Times New Roman",
        "Trebuchet MS",
        Verdana,
        "Zapf Dingbats",
        Zapfino
    )
    2013-09-28 15:54:13.378 iOSFontListTest[3753:60b] Font Names (
        AcademyEngravedLetPlain,
        "AlNile-Bold",
        AlNile,
        "AmericanTypewriter-Light",
        "AmericanTypewriter-CondensedLight",
        "AmericanTypewriter-CondensedBold",
        AmericanTypewriter,
        "AmericanTypewriter-Condensed",
        "AmericanTypewriter-Bold",
        AppleColorEmoji,
        "AppleSDGothicNeo-Thin",
        "AppleSDGothicNeo-SemiBold",
        "AppleSDGothicNeo-Medium",
        "AppleSDGothicNeo-Regular",
        "AppleSDGothicNeo-Bold",
        "AppleSDGothicNeo-Light",
        ArialMT,
        "Arial-BoldItalicMT",
        "Arial-ItalicMT",
        "Arial-BoldMT",
        "ArialHebrew-Bold",
        "ArialHebrew-Light",
        ArialHebrew,
        ArialRoundedMTBold,
        "Avenir-Heavy",
        "Avenir-Oblique",
        "Avenir-Black",
        "Avenir-Book",
        "Avenir-BlackOblique",
        "Avenir-HeavyOblique",
        "Avenir-Light",
        "Avenir-MediumOblique",
        "Avenir-Medium",
        "Avenir-LightOblique",
        "Avenir-Roman",
        "Avenir-BookOblique",
        "AvenirNext-MediumItalic",
        "AvenirNext-Bold",
        "AvenirNext-UltraLight",
        "AvenirNext-DemiBold",
        "AvenirNext-HeavyItalic",
        "AvenirNext-Heavy",
        "AvenirNext-Medium",
        "AvenirNext-Italic",
        "AvenirNext-UltraLightItalic",
        "AvenirNext-BoldItalic",
        "AvenirNext-Regular",
        "AvenirNext-DemiBoldItalic",
        "AvenirNextCondensed-Regular",
        "AvenirNextCondensed-MediumItalic",
        "AvenirNextCondensed-UltraLightItalic",
        "AvenirNextCondensed-UltraLight",
        "AvenirNextCondensed-BoldItalic",
        "AvenirNextCondensed-Italic",
        "AvenirNextCondensed-Medium",
        "AvenirNextCondensed-HeavyItalic",
        "AvenirNextCondensed-Heavy",
        "AvenirNextCondensed-DemiBoldItalic",
        "AvenirNextCondensed-DemiBold",
        "AvenirNextCondensed-Bold",
        BanglaSangamMN,
        "BanglaSangamMN-Bold",
        "Baskerville-Bold",
        "Baskerville-SemiBoldItalic",
        "Baskerville-BoldItalic",
        Baskerville,
        "Baskerville-SemiBold",
        "Baskerville-Italic",
        "BodoniSvtyTwoITCTT-Book",
        "BodoniSvtyTwoITCTT-Bold",
        "BodoniSvtyTwoITCTT-BookIta",
        "BodoniSvtyTwoOSITCTT-BookIt",
        "BodoniSvtyTwoOSITCTT-Bold",
        "BodoniSvtyTwoOSITCTT-Book",
        "BodoniSvtyTwoSCITCTT-Book",
        BodoniOrnamentsITCTT,
        "BradleyHandITCTT-Bold",
        "ChalkboardSE-Light",
        "ChalkboardSE-Regular",
        "ChalkboardSE-Bold",
        Chalkduster,
        "Cochin-Bold",
        "Cochin-BoldItalic",
        "Cochin-Italic",
        Cochin,
        Copperplate,
        "Copperplate-Light",
        "Copperplate-Bold",
        Courier,
        "Courier-Oblique",
        "Courier-BoldOblique",
        "Courier-Bold",
        CourierNewPSMT,
        "CourierNewPS-BoldMT",
        "CourierNewPS-ItalicMT",
        "CourierNewPS-BoldItalicMT",
        "DINAlternate-Bold",
        "DINCondensed-Bold",
        DamascusBold,
        Damascus,
        DamascusMedium,
        DamascusSemiBold,
        DevanagariSangamMN,
        "DevanagariSangamMN-Bold",
        "Didot-Bold",
        "Didot-Italic",
        Didot,
        EuphemiaUCAS,
        "EuphemiaUCAS-Bold",
        "EuphemiaUCAS-Italic",
        Farah,
        "Futura-Medium",
        "Futura-CondensedMedium",
        "Futura-MediumItalic",
        "Futura-CondensedExtraBold",
        "GeezaPro-Bold",
        GeezaPro,
        "GeezaPro-Light",
        "Georgia-BoldItalic",
        "Georgia-Bold",
        "Georgia-Italic",
        Georgia,
        GillSans,
        "GillSans-Italic",
        "GillSans-BoldItalic",
        "GillSans-Light",
        "GillSans-LightItalic",
        "GillSans-Bold",
        "GujaratiSangamMN-Bold",
        GujaratiSangamMN,
        "GurmukhiMN-Bold",
        GurmukhiMN,
        "STHeitiSC-Medium",
        "STHeitiSC-Light",
        "STHeitiTC-Medium",
        "STHeitiTC-Light",
        "Helvetica-Oblique",
        "Helvetica-Light",
        "Helvetica-Bold",
        Helvetica,
        "Helvetica-BoldOblique",
        "Helvetica-LightOblique",
        "HelveticaNeue-BoldItalic",
        "HelveticaNeue-Light",
        "HelveticaNeue-Italic",
        "HelveticaNeue-UltraLightItalic",
        "HelveticaNeue-CondensedBold",
        "HelveticaNeue-MediumItalic",
        "HelveticaNeue-Thin",
        "HelveticaNeue-Medium",
        "HelveticaNeue-Thin_Italic",
        "HelveticaNeue-LightItalic",
        "HelveticaNeue-UltraLight",
        "HelveticaNeue-Bold",
        HelveticaNeue,
        "HelveticaNeue-CondensedBlack",
        "HiraKakuProN-W6",
        "HiraKakuProN-W3",
        "HiraMinProN-W6",
        "HiraMinProN-W3",
        "HoeflerText-Regular",
        "HoeflerText-BlackItalic",
        "HoeflerText-Italic",
        "HoeflerText-Black",
        "IowanOldStyle-Bold",
        "IowanOldStyle-BoldItalic",
        "IowanOldStyle-Italic",
        "IowanOldStyle-Roman",
        Kailasa,
        "Kailasa-Bold",
        KannadaSangamMN,
        "KannadaSangamMN-Bold",
        MalayalamSangamMN,
        "MalayalamSangamMN-Bold",
        "Marion-Regular",
        "Marion-Italic",
        "Marion-Bold",
        "MarkerFelt-Thin",
        "MarkerFelt-Wide",
        "Menlo-BoldItalic",
        "Menlo-Regular",
        "Menlo-Bold",
        "Menlo-Italic",
        DiwanMishafi,
        "Noteworthy-Bold",
        "Noteworthy-Light",
        "Optima-Regular",
        "Optima-Italic",
        "Optima-Bold",
        "Optima-BoldItalic",
        "Optima-ExtraBlack",
        OriyaSangamMN,
        "OriyaSangamMN-Bold",
        "Palatino-Roman",
        "Palatino-Italic",
        "Palatino-Bold",
        "Palatino-BoldItalic",
        "Papyrus-Condensed",
        Papyrus,
        PartyLetPlain,
        SavoyeLetPlain,
        SinhalaSangamMN,
        "SinhalaSangamMN-Bold",
        "SnellRoundhand-Black",
        "SnellRoundhand-Bold",
        SnellRoundhand,
        "Superclarendon-Regular",
        "Superclarendon-BoldItalic",
        "Superclarendon-Light",
        "Superclarendon-BlackItalic",
        "Superclarendon-Italic",
        "Superclarendon-LightItalic",
        "Superclarendon-Bold",
        "Superclarendon-Black",
        Symbol,
        TamilSangamMN,
        "TamilSangamMN-Bold",
        TeluguSangamMN,
        "TeluguSangamMN-Bold",
        "Thonburi-Bold",
        Thonburi,
        "Thonburi-Light",
        "TimesNewRomanPS-BoldItalicMT",
        TimesNewRomanPSMT,
        "TimesNewRomanPS-BoldMT",
        "TimesNewRomanPS-ItalicMT",
        "Trebuchet-BoldItalic",
        TrebuchetMS,
        "TrebuchetMS-Bold",
        "TrebuchetMS-Italic",
        "Verdana-BoldItalic",
        "Verdana-Italic",
        Verdana,
        "Verdana-Bold",
        ZapfDingbatsITC,
        Zapfino
    )
    
    
    

    external by ZacharyWeiner modified Jan 3, 2015  34  0  1  0

    iOS7 Objective C Camera Code

    iOS7 Objective C Camera Code: gistfile1.txt
    - (IBAction)cameraBarButtonItemPressed:(UIBarButtonItem *)sender {
        
        UIImagePickerController *picker = [[UIImagePickerController alloc] init];
        picker.delegate = self;
        if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
            picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        }else if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]){
            picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
        }
        [self presentViewController:picker animated:true completion:nil];
    }
    
    - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        NSLog(@"Finished Picking");
        UIImage *image = info[UIImagePickerControllerEditedImage];
        if(!image){
            image = info[UIImagePickerControllerOriginalImage];
        }
        [self.photos addObject:[self photoFromImage:image]];
        [self.collectionView reloadData];
        [self dismissViewControllerAnimated:true completion:nil];
    }
    
    - (void) imagePickerControllerDidCancel:(UIImagePickerController *)picker
    {
        NSLog(@"Cancel Clicked");
        [self dismissViewControllerAnimated:true completion:nil];
    }
    
    - (Photo *)photoFromImage:(UIImage *)image
    {
        Photo *photo = [NSEntityDescription insertNewObjectForEntityForName:@"Photo" inManagedObjectContext:[TWCoreDataHelper managedObjectContext]];
        photo.image = image;
        photo.date = [NSDate date];
        photo.albumBook = self.album;
        
        NSError *error = nil;
        if(![[photo managedObjectContext] save:&error]){
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Erro!" delegate:nil cancelButtonTitle:@"Cacel" otherButtonTitles:nil, nil];
            [alertView show];
        }
        return photo;
    }
    
    
    
    @implementation TWPictureDataTransformer
    - (Class)transformedValueClass
    {
        return [NSData class];
    }
    
    - (BOOL)allowsReververseTransformation
    {
        return YES;
    }
    
    - (id)transformedValue:(id)value
    {
        return UIImagePNGRepresentation(value);
    }
    
    - (id)reverseTransformedValue:(id)value
    {
        UIImage *image = [UIImage imageWithData:value];
        return image;
    }
    @end
    
    
    

    external by soupsueapple modified Apr 29, 2015  34  0  1  0

    iOS7 + customBackBarButton

    iOS7 + customBackBarButton: gistfile1.mm
    - (void)addCustomBackBarButton{
        UIImage *image = [UIImage imageNamed:@"back.png"];
        
        UIButton *leftButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, image.size.width + 40, image.size.height)];
        [leftButton setImage:image forState:UIControlStateNormal];
        [leftButton setTitle:@"返回" forState:UIControlStateNormal];
        [leftButton addTarget:self action:@selector(onBack) forControlEvents:UIControlEventTouchUpInside];
        
        UILongPressGestureRecognizer *recognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressGestureRecognizerHandle:)];
        [recognizer setMinimumPressDuration:0.4f];
        [leftButton addGestureRecognizer:recognizer];
        
        UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
        leftBarButtonItem.style = UIBarButtonItemStylePlain;
        
        if(SystemVersion >= 7.0){
            self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
            UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]
                                               initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                               target:nil action:nil];
            negativeSpacer.width = -10;
            self.navigationItem.leftBarButtonItems = @[negativeSpacer, leftBarButtonItem];
        }else{
            self.navigationItem.leftBarButtonItem = leftBarButtonItem;
        }
    }
    
    - (void)longPressGestureRecognizerHandle:(UILongPressGestureRecognizer *)longPressGestureRecognizer {
        if (longPressGestureRecognizer.state != UIGestureRecognizerStateBegan)
            return;
        
        [self.navigationController popToRootViewControllerAnimated:YES];
    }
    
    -(void)onBack{
        [self.navigationController popViewControllerAnimated:YES];
    }
    
    

    external by JeOam modified Sep 10, 2014  23  0  1  0

    iOS7 Interactive Transitions

    iOS7 Interactive Transitions: InteractiveTransitions.md
    Demo:  
    ![](http://ww1.sinaimg.cn/large/6907a9d0gw1ek7el2tnfjg208r0d7kbf.gif)
    
    Implementation: [iOS7 interactive transitions](http://dativestudios.com/blog/2013/09/29/interactive-transitions/)
      
    ---
      
    Another Implementation: https://github.com/asifmujteba/iOSSharedViewTransition
    
    
    • Public Snippets
    • Channels Snippets