Dailycode.info

Short solution for short problems

iOS: FreeForm and UIScrollview: subviews do not react to scroll

After upgrading to iOS7 I've had some problems with a FreeForm combination with a UIScrollview.

First it didn't scroll at all, this was related to missing constraints. Then I noticed that some subviews were not sending their touches to the scrollview, or that the scrollview didn't react ot touches on subviews. 

After settings the 'Delays Content Touches' to YES, it worked again as normal.

What a relief.


iOS: Open second storyboard in modal with presentation curl.

I had a very large StoryBoard with a lot of relations. I started to group functionality and add the Views to different storyboards. Since iOS 7 and xcode 5 it came in a hurry, since the designer was crashing and messing up the layout.

First I just pushed the viewcontrollers in the navigation controller like this:

+(void) NavigateToCustomerLookupFrom:(UIViewController *)vc

{

    UIStoryboard * sb = [UIStoryboardstoryboardWithName:@"CustomerLookupStoryboard"bundle:nil];

    UIViewController * vcTo = [sb instantiateInitialViewController];

    

    [UIViewtransitionWithView:vc.viewduration:0.8options:UIViewAnimationOptionTransitionCrossDissolve

                    animations:^{

                        [vc.navigationController pushViewController:vcTo animated:NO];

                    }

                    completion:NULL];

    

}

That worked. But then I came up with a views that needed to be opened in a modal way. So this is the code to do just that. In this example I use the partial curl effect to open it:

+(void) NavigateToSignatureFrom:(UIViewController *)vc withSignee:(NSString *) Signee

{

    UIStoryboard * sb = [UIStoryboardstoryboardWithName:@"SignatureStoryboard"bundle:nil];

    UIViewController * vcTo = [sb instantiateInitialViewController];

    

    ((SignatureVC *) vcTo).Signee = Signee;

    

    [vcTo setModalTransitionStyle:UIModalTransitionStylePartialCurl];

    [vc presentViewController:vcTo animated:YEScompletion:nil];

}

The example also shows how to set properties of the destination controller.


xcode5: story board crashes

After upgrading to xcode 5, my xcode crashed when I opened a story board with some 20 Views on it. 

I tried several solutions, including waiting, clicking, wainting. But everytime the xcode seemed like loading and responded for a click every minute or so.

The reason the story board crashed, was apparently because I clicked once on the keep xcode 4.6 compatible. This made xcode crash. It started scanning the files and ...

So how to solve thisjQuery15201013488220050931_1381145930680

Right click on the storyboard and choose: 'Open As' -> Source code.

There you need to change the top of the document to be xcode 5 comatible. You can get the code from a story board in your solution that is working, or you can try to replace the code on the top of the document up until </dependencies> with this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="12F37" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES">

    <dependencies>

        <deployment defaultVersion="1552" identifier="iOS"/>

        <development version="5000" identifier="xcode"/>

        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>

    </dependencies>

 


xcode5: story board crashes

After upgrading to xcode 5, my xcode crashed when I opened a story board with some 20 Views on it. 

I tried several solutions, including waiting, clicking, wainting. But everytime the xcode seemed like loading and responded for a click every minute or so.

The reason the story board crashed, was apparently because I clicked once on the keep xcode 4.6 compatible. This made xcode crash. It started scanning the files and ...

So how to solve thisjQuery15201013488220050931_1381145930681

Right click on the storyboard and choose: 'Open As' -> Source code.

There you need to change the top of the document to be xcode 5 comatible. You can get the code from a story board in your solution that is working, or you can try to replace the code on the top of the document up until </dependencies> with this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="12F37" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES">

    <dependencies>

        <deployment defaultVersion="1552" identifier="iOS"/>

        <development version="5000" identifier="xcode"/>

        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>

    </dependencies>

 

You can now switch the View As to 'iOS 6.1 and Earlier' or 'iOS 7.0 and Later'.

You'll find this in the identity inspector when clicking on the story board outside of a view.