Showing posts with label iPhone. Show all posts
Showing posts with label iPhone. Show all posts

How to make UITextField readonly (but not disabled)?

iPhone/iPad: How to make UITextField readonly ?


iPhone/iPad: How to make UITextField readonly (but not disabled)?
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    BOOL editable;
    if (textField == myReadOnlyTextField) {
        editable = NO;
    } else if (textField == myEditableTextField) {
        editable = YES;
    } else {
        // editable = YES/NO/Other Logic
    }
    return editable;
}
 
- (void)viewDidLoad {
    [super viewDidLoad];
    // .....
    myReadOnlyTextField.delegate = self;
    myEditableTextField.delegate = self;
}

How to solve problems with apps stuck on 'processing file' in iTunes:

How to Fix Apps Stuck on "Waiting" [iPhone/iPad]


1. Restart the computer and then open iTunes > Store > Search for available downloads

If this didn't work, try the following steps:
2. Navigate to Finder > ~/Music/iTunes/iTunes Media/Downloads and delete the .tmp temporary app download files
3. Restart the computer and retry step 1 from above.

Tags: processing file, Apps in iTunes, 

iPhone HelloWorld 之HelloWorldAppDelegate.h

#import <UIKit/UIKit.h>
 
 @class HelloWorldViewController;
 
 @interface HelloWorldAppDelegate : NSObject <UIApplicationDelegate> {
     IBOutlet UIWindow *window;
 }
 

 @property (nonatomic, retain) UIWindow *window;
 
 @end

Code snippet about ActiveRecord on iPhone/iPod

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//    NSError **err;
ARSQLiteConnection *connection = [ARSQLiteConnection openConnectionWithInfo:[NSDictionary \
                                                                             dictionaryWithObject:[[NSBundle mainBundle]pathForResource:@"delicious" ofType:@"db" ] forKey:@"path"]\
                                                                      error:nil];
[ARBase setDefaultConnection:connection];

NSLog(@"### begin to put out people:");
for (People *people in [People findAll]) {
    NSLog(@"### First name:%@ ; Last Name: %@",people.firstName,people.lastName);
}
[pool release];

Detect the reachability of network on iPhone

SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, "www.google.com");
SCNetworkReachabilityFlags flags;
BOOL success = SCNetworkReachabilityGetFlags(reachability, &flags);
BOOL isDataSourceAvailable = success && (flags & kSCNetworkFlagsReachable&& !(flags &kSCNetworkFlagsConnectionRequired);
CFRelease(reachability);

if(isDataSourceAvailable)
{
// Do some network things.
}