Hello friends, many times we need to resize the UIImage runtime according to the need of application. Here is the function which changes the size of the image and returns a new resized image – (UIImage *)reSizeTheImage:(UIImage *)image convertToSize:(CGSize)size { UIGraphicsBeginImageContext(size); [image drawInRect:CGRectMake(0, 0, size.width, size.height)]; UIImage *destImage =...
How to record voice programatically and store on the server in iphone
CoreAudio.framework AVFoundation.framework ——————————————————————————————————— #import <AVFoundation/AVFoundation.h> #import <CoreAudio/CoreAudioTypes.h> Add delegate @interface...
Asynchronous Download images from Url And Save into Documents Directory in iphone
.h//—————————– @interface ViewController : UIViewController { UIActivityIndicatorView *ProccessIndicator; NSMutableArray *imgnmarr,*imgurlarr; } – (void) loadImageInBackground:(NSArray *)urlAndTagReference – (void) assignImageToImageView:(NSArray *)imgAndTagReference ...
Add UIButton on UITableView when drag , Swipe or touches moved on Cell Using UIGestureRecognizerDelegate in iPhone
//——– .h //Delegate UIGestureRecognizerDelegate UIButton *YourButton; //——– .m – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @”SimpleTableIdentifier”; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];...
Launch the app store app from your application
Step 1: Create an empty iPhone application with and add the UIViewController subclass to it. Step 2: Create a view just like the one given below and the add the view of this view controller into the iPhone window. Step 3: Create a function for the button and this function will contain the code for launching the app store application of the iOS device from your application. So declare a...
How to run/call Method when applicationDidEnterBackground And Get Updates By LocalNotification In Iphone/iPad Application
//————————————————————— AppDelegate.h UIBackgroundTaskIdentifier bgTask; //————————————————————— AppDelegate.m –...
Check String Contains in objective-c / xCode / iPhone
NSString *string = @"hello World";
if ([string rangeOfString:@"World"].location == NSNotFound) {
NSLog(@"string does not contain World");
} else {
NSLog(@"string contains World!");
}
How to create iPhone/iPad’s “Slide to Unlock” animation ?
This is how Apple implemented “Slider to Unlock” or “Slide to Power off” animation. In .h file UISlider *slider; BOOL touchIsDown; CALayer *textLayer; – (void)viewDidLoad { self.view.layer.backgroundColor = [[UIColor grayColor] CGColor]; UIImageView *sliderBackView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”SliderBack1.png”]]; sliderBackView.frame =...
How to create file and read/write Data in iphone/ipad
//Documents Directory Path NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; //Give file Name With Extention to create NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@”FileName.docx”]; [[NSFileManager defaultManager] createFileAtPath:savedImagePath...
/usr/include/objc/objc-class.h file not found
For this you need to change this import statement to,
#import <objc/runtime.h>
This applies to xCode 4.2 above