Skip to main content

Posts

Showing posts with the label interface-builder

iPhone: Create a reusable component (control) that has some Interface Builder pieces and some code

I want to create a reusable component (a custom control) for the iPhone. It consists of several standard controls prearranged on a View, and then some associated code. My goals are: I want to be able to use Interface Builder to lay out the subviews in my custom control; I want to somehow package the whole thing up so that I can then fairly easily drag and drop the resulting custom component into other Views, without having to manually rewire a bunch of outlets and so on. (A little manual rewiring is fine, I just don't want to do tons and tons of it.) Let me be more concrete, and tell you specifically what my control is supposed to do. In my app, I sometimes need to hit a web service to validate data that the user has entered. While waiting for a reply from the web service, I want to display a spinner (an activity indicator). If the web services replies with a success code, I want to display a "success" checkmark. If the web service replies with an error code,

What does the origin control do in interface builder?

In interface builder there is a control in the struts and springs inspector that is labeled origin. What does this do and why does changing it for one object change it for ALL objects? As far as I can tell it doesn't have any real effect on the frame rectangle origin as the name implies. Let me explain: Selecting a UILabel and changing the origin to be at the top right as in the photo above puts the frame origin at the point (280,11). However, in code, when you actually ask the frame for it's origin it is given as (211,11) which corresponds to the top left corner of the frame. Therefore, changing the frame origin in interface builder appears to do absolutely nothing! What is going on here?!

Why is UIGroupTableViewBackgroundColor causing Xcode 4.2 to choke?

I'm using Xcode 4.2 on Mac OS X Lion 10.7.3 and for some reason, every time I set UIGroupTableViewBackgroundColor as the background color on my UIView, the compiler refuses to build my app. When I open the "newly corrupted" XIB as XML and remove the offending XML represenation of the background color, the app compiles. I am able to apply the background color in code, but doing so in Interface Builder fails miserably. Here's the code that chokes Xcode. Any clue why this is happening? <object class="NSColor" key="IBUIBackgroundColor"> <int key="NSColorSpace">10</int> <object class="NSImage" key="NSImage"> <int key="NSImageFlags">549453824</int> <string key="NSSize">{512, 1}</string> <array class="NSMutableArray" key="NSReps">

How to return from "partial curl&rdquo; type segue

I am attempting to use a partial curl segue to reveal an options view underneath my main view. This is identical to touching the "page curl" button in the bottom right corner of the Maps app. I can successfully execute the segue to the option view, my problem is returning to the main view. I'm hoping to replicate the reverse animation effect of the Maps app as the edge curls back flat and the main view is shown. It doesn't seem logical to create another segue to return back to the main view (what I would do if I were not using the partial curl segue) because the return segue is associated with the original segue. Thanks in advance for any help!