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 →
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 →
Oops concept in objective C
Apple has documented a best illustration on Opps concept which is base of Objective C . You can checkout and learn how Opps concept is using in Objective C https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/OOP_ObjC/Articles/ooObjectModel.html#//apple_ref/doc/uid/TP40005149-CH5-SW6
CoreData Day-1 :: What is coreData ?
Core Data:: Core Data is an object graph and persistence framework provided by Apple in the Mac OS X and iOS operating systems. It was introduced in Mac OS X 10.4 Tiger and iOS with iPhone SDK 3.0. It allows dataorganised by the relational entity–attribute model to be serialised into XML, binary, or SQLite stores.... Continue Reading →
How to use Swift code in Objective C class
Now you can easily use swift code in your objective C class. Step 1. Go to packaging in Build setting and get Product Module Name. Change it or write any other name. see attached image. Step 2. Go to Object c class in which you want to use Swift class. and import class as following.... 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 →
Use HexColor in Swift as a color
Add it in your class extension UIColor { convenience init(red: Int, green: Int, blue: Int) { assert(red >= 0 && red <= 255, "Invalid red component") assert(green >= 0 && green <= 255, "Invalid green component") assert(blue >= 0 && blue <= 255, "Invalid blue... Continue Reading →