Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Share image on Pinterest in iPhone

To share an image to Pinterest write below code to achieve it. NSString *str =@"https://www.hallaminternet.com/assets/URL-tagging-image.png"; pinterest = [[Pinterest alloc] initWithClientId:@"1438888" urlSchemeSuffix:@"prod"]; [pin...

Solution for Pods-prefix.pch error

In Xcode 6.1 and above versions sometimes we get this Pods-prefix.pch error. To resolve this issue you just need to follow simple steps. Quit Xcode. Go to Libarary > Developer > Xcode > Derived Data Remove All Derived Data. Do...

Unique Key in Core data

There is no such method to create an unique Key attribute in core data Entity. But we can insert data into entities on the basis of an unique json or XML data object. Here is an example:- While parsing API Json Data write the below code ins...

Copy text to Clipboard or PasteBoard in iPhone

If you want to copy text from an app to iPhone clipboard or PasteBoard then write below code. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.string = @"String that you want to copy." ; Now you can access ...

Face detection with OpenCV in iOS

Hello Readers! If you want set face detection in iOS (iPhone) follow the steps given below. First of all we need to add opencv framework to our project. There are severel ways to do that. But the most simple is as follows: Make framework v...

How to get sub strings from a string using Regular Expression

Hi, The below code is to get substrings from a string. You are going to love this below code which is very simple but very effective. I have used regular expression to get the sub strings. NSString *strTest = @"Hii how are you doing @Ravi , h...

Adaptive UI concept

With the launch of bigger screens of iPhones , Apple also introduced Adaptive UI concept. There are some main things you should know to work with Adaptive UI. 1) Size classes 2) Align Create alignment constraints, such as aligning the left ...

Integrate Facebook SDK in ios

Hi, Download Facebook SDK from following link- https://developers.facebook.com/docs/ios Add SDK to your project. This code will help you login and get user data as well fetch friend list from specific account. FBManager - Create a...

Network check for wifi 3g 4g

Hi Guys, You can use this function before hitting any server api. This will check whether your device is connected to network or not. + (BOOL)isNetworkAvailble{ const char *host_name = "google.com"; BOOL _isDataSourceAvai...

How to clip an audio file in iPhone?

Here is the method in ios that can clip an audio file(i.e MPMediaItem) with the time interval. In below mentioned method, For time interval we are sending two parameter first is startinterval which is the interval form where we wanted to start...

How to Compress Video File Through coding in ios

Hello all, Refer the code below to compress the video file and save the compressed file in document directory. - (void)compressMyVideo:(NSURL *)videoPath completionBlock:(void(^)(id data, BOOL result))block{ NSLog(@"compressing ====%@"...

Objects and method parameters and return types in Objective C

Objects: In general objects are the real world entity. Earlier the two functions communicate with each other using the function call(say programming in c) but the programmer need more better approach for communication between the two functions o...

Difference between "==" and "isEqual:" in objective c

These two operators or function can be used to check equity of objects or operands. "==" is used to check if pointer values of objects are same. However "isEqual:" is used to test if both objects are having same values. So "==" works on reference...

Protocol Inheritance

Like classes and controllers, protocols itself can also be extended and can be used to produce new protocols. Here we are creating a base Protocol with superset methods. We can also call it original protocol. it is inherited from NSObject, li...

nil, NULL, Nil, NSNull in objective c

4 kind of zeros are used in objective c - nil, Nil, NULL and NSNull. All of these are different with their properties. Usually in programming nil and NSNull are used in objective c and NULL is used with c/c++ statements. Type of nil is defined as...

Accessor Methods in iPhone

accessor methods is used to access or set an objects properties: Syntax- NSString *firstName = [somePerson firstName]; [somePerson setFirstName:@"Johnny"]; These accessor methods are by default and automatically synthesized by the ...

What is Atomic property in iPhone sdk?

Atomic properties are thread safe. To understand atomic property it is important first to take a little focus on multi-thread programming. In multi-thread programming different threads can use same property so it is must to apply thread handl...

Handling NSError in Objective

Error in Objective treated as Object and inherited NSObject. NSError object encapsulate three types of information 1) Code - Nsinteger value which give the errors unique identifier 2) Domain - NSString value having error domain 3)...

Classes and implementing methods in Objective C

Hello Guys In this blog, I have declared HomeViewController class and explained how to implement methods in class. HOMEVIEWCONROLLER.H #import <UIKit/UIKit.h> @interface HomeViewController : UIViewController // With the help of int...

Self Or Super Keywords in iPhone

The Self and Super Keyword in IOS are important and one should know why and how they are used in objective c. One should always access the instance variables directly from or within an initialization method. Because at the time when property is ...

alloc and init methods in objc

In Objective C we create objects wherever we want. NSObject class is the root class which holds alloc and init methods. Here is an example to understand the concept in details. id Object = [NSObject new]; // Creates and returns an initialize...

Objects message sending and receiving in Objective C

In Objective C language one don't "invoke a method on object" it "passes the message to object". Between these to concepts "calling a method" and "message passing", there is no major difference in implementation but they are different in executio...

Inheritance in Objective C

Inheritance in Objective C can be done by Subclassing. Here is an example of inheritance that works in objective-c. **In Rectangle.h** @interface Rectangle: NSObject @property (nonatomic) int width; @property (nonatomic) int height; ...

NSLog with Locale

NSLocale class provides information about system language like the language that iPhone is currently running on, the list of supported language etc. To get the current language code use following lines of code. NSString *code = [[NSLocale c...

How to underline label text of UIButton?

Underlining title text of UIButton can be done with attributed string using following code (In this case yourTitleLabelText is title text for button and yourButtonObject is button object): NSMutableAttributedString *titleString = [[NSMutableAt...

Push Notification in iOS8 and other versions

PushNotification code for Latest iOS8 and earlier versions. You need to find out the iOS version first. Use below Macro keys for iOS check:- #define IS_iOS7 [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0?YES:NO #define IS_...

NSDictionary

NSDictionary class represents an unordered collection of objects associate each value with a key. Create NSDictionary NSDictionary *cars = @{ @"Mercedes" : @"Benz SLK250"], @"BMW M3 Coupe" : @"M3 Coupe", @"Honda" : @"Civi...

Passing block as function argument in Objective C

Yes, we can pass the Block as argument in function. Here it is : let suppose i create a class Downloader First declare a Block in Downloader.h: typedef void (^DownloadComplete)(double,double,double,BOOL,id,id); then declare method a...

Weak and Strong Reference

Strong- A strong reference means we want to own that object we are referencing with property or variable. Any object assign to this property will not be destroyed as long as it is not assign to strong reference. Weak - A weak reference is not...

NSMutableSet

Add/Remove objects from a NSMutableSet. If you want to remove add or remove objects from NSMutableSet follow the below code- NSMutableSet *brokenCars = [NSMutableSet setWithObjects: @"Honda Civic", @"Nissan Vers...

How to combine two NSSet objects?

Hello all, If you want to combine to NSSet objects, use the below code- NSSet *affordableMakes = [NSSet setWithObjects:@"Ford", @"Honda", @"Nissan", @"Toyota", nil]; NSSet *fancyMakes = [NSSet setWithObj...

NSSet

An NSSet object represents a static, unordered collection of distinct objects. NSSet/NSMutableSet, NSArray/NSMutableArray, and NSDictionary/NSMutableDictionary are the three core collection classes . NSSet is immutable and NSMutableSet is mu...

NSArray with different functions and operations.

NSArray and NSMutableArray are Objective-Cs general array types. It represents an ordered collection of objects, and it provides a high-level interface for sorting and manipulating lists of data. NSArray are immutable type where NSMutableArray...

Block variable in objective C

Block access the data in normal way as the other normal function do. Block can access any class variable or function variable out side it but cannot modified it. int x= 111; void (^printXAndY)(int) = ^(int y) { printf("%d %d\n", x, y);...

replacement of the deprecated sizeWithFont: method in iOS 7

we all know NSString method sizeWithFont [@"abacfe" sizeWithFont:[UIFont systemFontOfSize:11] constrainedToSize:maximumLabelSize lineBreakMode:NSLineBreakByCharWrapping]; deprecated in iOS 7. So here is the replacement of this method. ...

When to use copy Attribute in declaring a property in objective c

We all use attributes in Objective C to declare properties. Attributes commonly used are strong, nonatomic, weak, assign. But we never take it seriously why we are using these attributes. One of the common mistakes I often see is the wrong us...

What is use of synthesize?

The @property and @synthesize keywords simply automate the creation of getter and setter methods, @interface MyClass : NSObject @property int value; @end   @implementation MyClass @synthesize value; @end The @property keyword d...

__weak and __unsafe_retained

__weak and __unsafe_unretained are the ownership qualifiers introduced by LLVM Compiler 3.0. By default all pointers are __strong under ARC which means that when an object is assigned to a pointer, it is retained for as long as that pointer re...

Interface and Property

Interface Interface is where you define the attributes and methods of class. In objective C the file where the declaration of class is done is called the interface file and the file where the class is defined is called the implementation file...

Mutable and Immutable Objects

Object which we create can either be mutable or immutable. For example: Immutable : NSString *str = [[NSString alloc]init]; Mutable: NSMutableString *str = [[NSMutableString alloc]init]; When we edit Mutable Object it will chang...

Basic Block Syntax using Objective C

Block are piece of code introduced in ios 4.0. Block are used to make code cleaner and reduce dependency from delegates. To use the block first we have to declare the block and then its definition. Here is the syntax to declare to the Block...

how to compress the recorded video

Hello all, Use the following code to compress the recorded video quality and size. - (void)compressRecordedVideoWithInputURL:(NSURL*)inputURL outputURL:(NSURL*)outputURL ...

Rounded corner in XIB or storyboard

Hi, I am writing for the first time on FindNerd. Many times we need to make buttons, labels, imageview, view to have rounded corner. and we write code as below to perform it. [redButton.layer setCornerRadius:15.0f]; [redButton.laye...

Divide image in equal parts wrt number of row and number of column.

With the help of following code you can divide UIImage into equal parts w.r.t number of row and number of column. Create a category of UIImageView and UImage and write the following method respectively in them. -(NSArray *)divideImageViewIn...

User's location update on server when app is in background.

Code for those Apps where we need to update user's current location in regular interval of time even if app is in background state. In Appdelegate.h write this code:- @property (nonatomic,strong) UIBackgroundTaskIdentifier *bgTask; In Ap...

Scroll table view to top and bottom in iOS

If you want to scroll the tableview to the top row or bottom row right after it appears. Then do one line code to achieve this. Scroll table to the bottom row position [_tableViews setContentOffset:CGPointMake(0, CGFLOAT_MAX)]; Scroll ta...

Animate button with zoom and bounce effect in ios

Many social apps are using bouncing effect for buttons and view. Just like Instagram and Facebook is using for LIKE. Here is the few lines of code. Simply just use your control (UIButton, UILabel, etc etc) instead of view down here... [UIV...

resize UIImage without losing quality (not screenshot)

Use the below code for cutting UIImage in high quality without blur (not screenshot) tmp is image view <p>UIGraphicsBeginImageContextWithOptions(tmp.frame.size,YES, 4.0);</p> <p>CGContextRef c = UIGraphicsGetCurrentCon...

Crop an image from UIImageView

With the following method stated below you can crop an UIImageView. -(UIImage *)cropedImage:(UIView *)view{ UIGraphicsBeginImageContextWithOptions(view.frame.size, imageView.opaque, 4.0); CGContextRef c = UIGraphicsGetCurrentConte...

Compile your code even when application is in background

When application enters in background the compiler stop working and it has to wait till application enter foreground. Use following code to compile some of your code even when application is in background bgTask = [application beginBackground...
1 10 12 13
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: