UITextView not editable - xcode

I am very confused by the following - I realise a difficult question to answer but ...
I have a number of UITextViews all set up in exactly the same way. Other than their name and position on the screen they are all identical. All settings are exactly the same in the File Inspector. They are established in the same way:
#property (weak, nonatomic) IBOutlet UITextView *timeStamps;
#property (weak, nonatomic) IBOutlet UITextView *slider1Comments;
When a button is pressed they are activated.
timeStamps.editable=YES;
[timeStamps setUserInteractionEnabled:YES];
slider1Comments.editable=YES;
[slider1Comments setUserInteractionEnabled:YES];
However, when I press the button I am not able to enter anything into timeStamps while I can in slider1Comments.
I have just upgraded to Xcode 5 and noticed a number of changes - maybe it is related. Any ideas?

try doing this
uncheck the "editable" and "user interaction enabled" for both the uitext views and set the delegates for both textviews in interface builder
hope it helps..

Related

UIButton and UILabel not showing up on device screen

I have a UILabel and UIButton in my Xib interface builder. The 600x600 screen says what I'll dragging+dropping on is a View.
When I drag and drop the label and button onto the view, and make them IBOutlet properties, they seem to not be part of any view hierarchy.
#property (retain, nonatomic) IBOutlet UILabel *label;
#property (retain, nonatomic) IBOutlet UIButton *button;
They each have their own respective constraints.
Here's two images.
Interface Builder
Interface Builder Outlet
I have synthesized both properties. Do I need to do anything programmatically? I thought Interface builder took care of everything, which is why I ask. The class in question is a custom subclass of a UIViewController, so do I need to drag and drop on to a view controller instead?

How to get value of textfield in AppDelegate in Xcode

I have 2 textfields in a view. I want to read value of this fields in AppDelagate.m.
It is very strange that does not work me all methods.
I posted my code here:
in First View
#property (nonatomic, retain) IBOutlet UITextField *Usernametxtbx;
#property (nonatomic, retain) IBOutlet UITextField *Passwordtxtbx;
Can you help me?
Its very odd that you need to read the values of outlets in an AppDelegate. AppDelegate is to handle your app delegate methods such as when your app launches or when your app is supposed to enter background. In didFinishLaunchingWithOptions, the outlets will be nil. You should be doing these tasks in viewDidLoad.

Showing Dialog from Xib file

I have a simple task.
There is a xib file named "Preferences.xib"
It contains Window named "Preferences Window", that contains some checkboxes, OK and Cancel.
I need to load this window within my code, and get Ok/Cancel results knowing what checkboxes were checked.
Can someone help me with example or send me to relevant link?
Thanks!
In AppDelegate.h
#interface AppDelegate : NSObject <NSApplicationDelegate>
#property (assign) IBOutlet NSWindow *window;
- (IBAction)showPref:(id)sender;
#property(strong)NSWindowController *windowController;
#property(strong)IBOutlet NSWindow *prefWindow;//hooked to the window of Preferences.XIB
#end
In AppDelegate.m
- (IBAction)showPref:(id)sender {
self.windowController=[[NSWindowController alloc]initWithWindowNibName:#"Preferences"];
self.prefWindow=self.windowController.window;
[self.prefWindow makeKeyAndOrderFront:self];
}
Find sample code here.

Xcode UIImageView won't link to the code

I have a problem:
I need to insert a UIImageView into my application that changes images each time. The code I have written is correct, but the UIImageView box I dragged on my view in storyboard won't link to the code. I drag the blue line on the codes but it just does not link.
#property (nonatomic, retain) IBOutlet UIImageView *image1
Can you help me????
Two possible things:
are you also adding it in your #Interface in the .h file? like below:
#interface FirstViewController : UIViewController {
IBOutlet UIImageView *image1;
}
Also, after you do this make sure you are linking your UIImage View to your files owner in the .xib file. control drag from "File's Owner" right into the image view.
I don't have a ton of iOS experience, but these are two pretty common problems.
h file
#property (nonatomic, retain) IBOutlet UIImageView *image1
m file
#synthesize image1;
Link should show up.

UITextField text not changing on the UI

Once the code bellow is executed, the textfield's text doesn't change in the UI to "Fly" but the second NSLog does print "TextField: Fly" as it should.
#property (strong, nonatomic) IBOutlet UITextField *typeTextField;
....
UITableViewCell* cell = [self.theTableView dequeueReusableCellWithIdentifier:#"TypeCell"];
self.typeTextField = (UITextField*)[cell viewWithTag:1];
NSLog(#"TextField: %# ", self.typeTextField.text);
self.typeTextField.text = #"Fly";
NSLog(#"TextField: %# ", self.typeTextField.text);
Any help would be much appreciated.
You almost definitely forgot to connect the outlet for the UITextField in interface builder. Bring up the .xib file that that typeTextField is visible in, click on typeTextField, then show the Utility pane (the one on the far right in Xcode 4+). Click the Connections Inspector (the one that looks like a right arrow) and drag a New Referencing Outlet to your File's Owner.
When you don't connect the UITextField you drew in Interface Builder with the IBOutlet that you identified in your source file, both UITextFields get created as separate entities. You can make changes and work with the valid typeTextField with a broken IBOutlet, but it'll never appear on your view.
Consult How to connect an IBOutlet from an UITableViewController directly to custom cell? and http://www.youtube.com/watch?v=d_kO-J3DYvc on properly wiring your custom UITableViewCell objects.

Resources