Wednesday, May 7, 2014

Event that is called when textfield got selected in iPhone

-(void)textFieldDidBeginEditing:(UITextField *)textField { //Keyboard becomes visible

    //perform actions.
}

Also have to set delegate self
self.mField.delegate=self;
@interface YourViewController : ViewController<UITextFieldDelegate>

Tuesday, May 6, 2014

Multiple views and dragging in Apple IOS for iphone

good tutorial is at
http://ios-blog.co.uk/tutorials/create-multiple-views-and-make-the-touched-view-follow-the-users-touch/

youtube video in iphone

http://stackoverflow.com/questions/15717754/objective-c-how-to-autoplay-a-youtube-video-in-a-uiwebview

Disappearing Keyboard on iPhone on touching anywhere on the UIView

#pragma mark - allow keyboard to dismiss by tapping anywhere not otherwise tappable on the view
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    LogDebug(@"touchesBegan:withEvent:");
    
  
   //-------------
  
    [super touchesBegan:touches withEvent:event];

}

Schedule Timer on iPhone apps

Function nameOfTheFunctionToBeCalled will be called after 6 secs.

NSTimeInterval timeInterval = 6; //seconds
        [NSTimer scheduledTimerWithTimeInterval:timeInterval
                                         target:self
                                       selector:@selector(nameOfTheFunctionToBeCalled)
                                       userInfo:nil

                                        repeats:NO];


iPhone goes to sleep even with idleTimerdisabled=YES

Find the solution from here

If your application is using camera then app will go to sleep after using camera . So you need to add UIRequiredDeviceCapabilities in your app plist . Different devices you can add as shown here


After camera access, idletimerdisabled setting changed back to original



Monday, May 5, 2014

Changing Text Color of UICollectionViewCell on selection programmatically

Have to overwrite the setSelected method of UICollectionView Class. Don't forget to call super as well. 

-(void)setSelected:(BOOL)selected{
    [super setSelected:selected];
    if (selected) {
       self.tagLabel.textColor=[UIColor blackColor];
    }
    else
        
     self.tagLabel.textColor=[UIColor lightTextColor];
    

}