UIView Frame vs Bounds


UIView Frame vs Bounds When working with views and trying to configure the layout for an application, it’s important to know the difference between a view’s bounds and frames. Many developers get confused between the frame and bounds and when they should use the two properties. The main reason is because many developers do not know... Continue Reading →

Advertisements

Delegate vs Notification in iOS


Both terminology provide a way by which iOS object communication to each other in iOS application Delegate faster creates a has-a relationship between the two classes Good architecure, You gain compile time checking for required methods when you use  protocols with your delegates, so you know when you compile if you're missing any required methods... Continue Reading →

Block as a completion Handler in iOS


Block as a completion Handler in iOS In Objective-c declare a méthode:: -(void) getCallBack:(NSString *)string1 onCompletion:(void(^)(NSString *sting))handeler; function implementation: -(void) getCallBack:(NSString *)string1 onCompletion:(void(^)(NSString *sting))handeler{          handeler(string1); } function calling: [self  getCallBack:@"Sunny" onCompletion:^(NSString *value){         NSLog(@"My name is %@",value);     }]; In Swift function declaration:: func getValueByMultiPle(value1:Int,value2:Int,onCompletion:((success:Int)->Void),onError:((errorValue:String)->Void)){     ... Continue Reading →

Common method in Swift


1. Check for any field empty in NSDictionary class func checkforEmptyValueinDictioanty(dic:NSDictionary)-> Bool{ for (keyVal, dataVal) in dic {   if (dataVal.length()==0){                 println("\(keyVal): \(dataVal.length())")                 return false             }                 ... Continue Reading →

Use different font text in a Label in swift


let secondLabel=UILabel(frame: CGRectMake(0, 16, _screenWidth-2, 20))         secondLabel.textColor=UIColor.whiteColor()         secondLabel.textAlignment=NSTextAlignment.Center         secondLabel.font=UIFont(name: "Arial", size: 12)         bottomView.addSubview(secondLabel)                  let attrSting=NSMutableAttributedString(string: "I agree to the Terms of Service and Privacy Policy.")             ... Continue Reading →

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: