I've been mocking about on the internet for a while and found this bit of code:
.h
IBOutlet UITextField *TextField;
.m
[TextField setValue:[UIColor lightGrayColor]
forKeyPath:#"_placeholderLabel.textColor"];
It's not working I'm using IOS 6.1 Running in the Simulator.
Is it because I haven't subclassed the given UITextField?
Regards,
Daniel
Your code should work as long as you have initialized the UITextField in IB already (or in code). At least it works for me in Xcode 5/iOS 7.
Related
I've done iOS for a few years, but I'm new to OS X.
I'm using the document-based template in Xcode 6. I added a textfield to the view controller in the storyboard. How do I access it from the Document?
I added:
#property(nonatomic, weak)IBOutlet NSString* aString;
to Document.h. When I drag to it, IB seems to be forcing me to use bindings. OK with me, but I'm still very weak on bindings. The dialog box asks for a number of values, most of which I can guess. But, what does "Custom Class" mean, and what should I put there?
A little help here would certainly be appreciated.
Thanks
You don't. The IBOutlet for the textfield should be in the NSViewController subclass (ViewController in the template Xcode project).
Your next question will be "How do I access the NSDocument from my view controller?"; Mac App Storyboard - Access Document in NSViewController ;-)
So I understand that I can not use storyboard on anything less then 5.0. I have finished my App using storyboard only so am very basic to code.
I am going to re-create my app using XIB, I will create a new XIB file for each of my storyboards.
Want I would like help with is the code I need to cross-fade between each XIB. There will a button linking each XIB.
What do I need to add to ViewController.h and where do I put the code into ViewController.m
Thanks a lot for your help.
Bryce
This is what I use.
- (IBAction)changeViews:(id)sender
{
ModalViewControllerTwo *modalViewControllerTwo = [[ModalViewControllerTwo alloc] init];
modalViewControllerTwo.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[rootViewController presentModalViewController:modalViewControllerTwo animated:YES];
}
I have a major problem. My app was working perfectly fine back in xcode 4.2 and in iOS 5.0. However, when I updated to xcode 4.3.2 and iOS 5.1, I ran into an issue.
When I try running my app now, ios simulator comes up with my splash screen and then a blank white screen with a status bar. I also get
2012-04-08 20:46:48.025 Birdflix[67666:fb03] Application windows are expected to have a root view controller at the end of application launch
in the log.
Please help, I really need to publish my app. Thanks in advance.
Please set self.window.rootViewController in
the application:didFinishLaunchingWithOptions: method in AppDelegate.m.
Sorry, I haven't Xcode4.3.2, not always say rightly.
xcode 4.2, don't use MainWindow.nib, so you should specify self.window.rootViewController.
the rootViewController is the ViewController that AppDelegate's view controller in
previous version's MainWindow.nib.
Suppose the class is RootViewController, then
#import "RootViewController.h"
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window.rootViewController = [[RootViewController alloc] init];
[self.window.makeKeyAndVisible];
return YES:
}
Using xcode I have created an interface with several buttons, the problem I am having is that I would like to change the image on a button once it has been clicked. I understand how I would do this if I created the button programatically but no idea how to change an image that was created in the interface builder.
I don't really want to start from scratch and build the interface again programmatically so
if anyone could point me in the right direction I would appreciate it.
Thanks.
Use the button image property:
#property(nonatomic, readonly, retain) UIImage *currentImage
You will need to have established an IBOutlet connection to the UIButton.
Make sure your class has a corresponding UIButton property for the button:
#property(nonatomic, strong) IBOutlet UIButton *m_Button;
Then in the User Interface builder you can connect the button and the outlet.
In your code you can then access the button properties like you created it programatically.
In interface builder my outlets and ibactions won't connect. They simply won't show up, like it doesn't exist.
Here is my code:
#interface RootViewController : UIViewController {
IBOutlet UILabel *time;
}
-(IBAction)changetime;
In Interface Builder the only two connections there are is:
view
searchDisplayController.
Please Help!
Had the same issue. Make sure you save (Shortcut: Ctrl+S) your .h before opening your .xib file.