interface-builder

I didn't check the Targeted for iPad option when creating a View Controller. How can I fix my UIView to be targeted for iPad devices using XCode 4.2?

徘徊边缘 提交于 2019-12-29 07:52:12
问题 I made a mistake when I created one of my UIViewController objects. When I created the files, I forgot to select the Target for iPad option. I never considered this to be much of an issue, because I always change my initial view within the generated Nib file to not display a statusbar, and to be freeform in sizing. However, I've recently ran into a problem. The UIViewController that I created that wasn't Targeted for iPad has a toolbar on it. This means that the default style is a bluish

Making UILabel touchable

天涯浪子 提交于 2019-12-29 04:36:32
问题 I have a UILabel and I would like to make it react to a touch. I tried putting a button on top of the label, thanks to this I could interact with the button. However, the button cannot be fully transparent, right? I could set an alpha of the button to 0,02, but it is still visible on by background. How to solve this? Maybe I could set the properties in some other way to make them fully invisible? Or is there some other solution? 回答1: First, why not just use a button and set the button title

this class is not key value coding-compliant for the key XXXXXX

萝らか妹 提交于 2019-12-28 03:11:47
问题 when i try to build and run my app, it crashes and i got this in the log : reason: '[<LoadingViewController 0x6b2c5a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aproposViewController.' the strange is that aproposViewController is not used in LoadingViewController , it's just another view controller in my app. please help, thx in advance :) EDIT appdelegate.h : @class LoadingViewController; @interface TopStationAppDelegate : NSObject

Does an IBOutlet needs to be a property & synthesized?

狂风中的少年 提交于 2019-12-28 01:41:11
问题 In most examples I see the following setup of IBOutlets: (Example A) FooController.h: @interface FooController : UIViewController { UILabel *fooLabel; } @property (nonatomic, retain) IBOutlet UILabel *fooLabel; @end FooController.m: @implementation FooController @synthesize fooLabel; @end But this works also fine (notice: no property and no synthesize): (Example B) FooController.h: @interface FooController : UIViewController { IBOutlet UILabel *fooLabel; } @end FooController.m:

Apple Interface Builder: adding subview to UIImageView

烈酒焚心 提交于 2019-12-27 17:02:53
问题 I created UIImageView with the help of Interface Bulder. Now I want to place label inside it (as its subview). In code I can type something like: [myUIImageView addSubview:myUILabel]; But can I do it with the help of IB? I found the solution for UIView , but can't find something similar for UIImageView . 回答1: You cannot add a subview to UIImageView in interface builder for reasons only known to Apple! You are right in saying that you can addSubview programmatically, but then, the overhead of

Springs in Auto Layout: Distribute views evenly, with constraints, in Xcode 5

喜你入骨 提交于 2019-12-27 10:22:12
问题 I understand the old Struts and Springs method of aligning, sizing and distributing views in Interface Builder. However, I cannot seem to figure out how to evenly distribute views using auto layout with Xcode 5. There was a way to do it using Xcode 4, but that option is gone. I have 7 buttons arranged in a vertical stack. On a 3.5" layout, it looks great. When I preview the screen in the 4" layout, all of the buttons remain tightly packed and there is a large amount of space below the last

Having trouble hooking up instance variables to AppDelegate

╄→尐↘猪︶ㄣ 提交于 2019-12-25 14:48:42
问题 Am having some trouble hooking up instance variables in the visual object editor using Xcode4. Have been able to connect the Whereami App Delegate to the mapView and activityIndicator, but for some reason, can't find the locationTitleField. Am also having trouble connecting the delegates back to the App Delegate. What am I doing wrong? Here is the code for Whereami App Delegate.h: #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> #import <MapKit/MapKit.h> @interface

Place an UIImage after an UILabel

时间秒杀一切 提交于 2019-12-25 13:37:10
问题 I want to have an UILabel with a max width of 100 and after that an UIImage, how can I do that in interface builder? I want that if the text is shorter the label is less than 100 but the UIImage is right behind the label. 回答1: you can do it with code like this: first init the label and the imageView _label = [[UILabel alloc] initWithFrame:CGRectZero]; _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(label.frame.origin.x + label.frame.size.width, label.frame.origin.y, 30, 30)]; then

Is there a pre-iOS 4 replacement or workaround for UINib?

走远了吗. 提交于 2019-12-25 04:57:06
问题 My application features a tableview which contains some rather complex tableviewcells. Therefore, these cells have been designed in Interface Builder and are instanciated later as needed using UINib which allows just that - load the content from a nib and instanciate it as needed. But UINib is only available for iOS 4.0 and above. Before I go ahead and abandon all the 3.x users, is there a way to (easily) recreate what I'm doing using pre-iOS4 classes and methods? Thanks alot!! 回答1: You can

Programmatically defined view in interface builder

谁都会走 提交于 2019-12-25 03:46:09
问题 I have created an OpenGL ES 2.0 view that takes up the iPad's whole screen and I am rendering some things to it. now I want to resize the view to make it smaller and then add some components to control the content of the opengl view. this view is completely defined programmatically but my goal, because I want to add in some controls, is to use interface builder. how do I import this OpenGLView into interface builder? 回答1: I've figured out how to do it. You simply create a UIView in IB and