A Guide to the iOS 7 Status Bar

In previous versions of iOS, the status bar was untouchable other than color adjustments. iOS 7 makes the status bar transparent, and, if your view doesn’t make use of a UINavigationController, then the 20 points of space at the top of the screen that the status bar sits on top of becomes usable space. This change makes the UINavigationController a major factor in the development of your app.

Read the full tutorial here

Quote

iOS OTA Provisioning And Distribution

This article is an explanation of how to do over the air deployment of an ad hoc iOS application build manually using a self-hosted web server. If self-hosting of the ad hoc files is not a requirement then I would recommend using a third party service such as Test Flight or a possibly a self hosted, fully managed solution like Hockey.

Read full article here

Edit: For iOS 7.1 onwards make sure you are using https url for plist file link.
itms-services://?action=download-manifest&url=https://example.com/Application.plist

Developing iPhone and iPad Apps that Leverage Windows Azure

You are building apps for the iPhone/iPad, yet you remain curious about what the cloud can offer. Is it possible to deploy scalable, mobile Web applications on Windows Azure? How about storing data in the cloud? Is it possible to use the cloud for push notifications to the device? In this session you’ll learn how to integrate iOS applications into an existing Windows Azure infrastructure, and what types of applications other organizations are building. You’ll walk away confident in knowing how to extend your existing applications to take advantage of features on the device together with services in the cloud.

Click here for video clip

Excluding file from compilation in Xcode

By default, when you create a new file or import a file into Xcode, if the file type is recognized as a source file (.c, .m .js, etc), the file is added to the Compile Sources folder in the application target.
You may not always prefer this default action – for example, if a JavaScript file is imported, Xcode does not know what to do with this file type so a compile warning is generated

Read More

Creating an UIImage with given text and size


static UIImage *createImageWithText(CGSize imageSize, NSString *text) {

// Create a bitmap graphics context of the given size
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, imageSize.width, imageSize.height, 8, imageSize.width*4, colorSpace, kCGImageAlphaPremultipliedLast);
CGColorSpaceRelease(colorSpace);
if (context== NULL) {
return nil;
}

// Custom CGContext coordinate system is flipped with respect to UIView, so transform, then push
CGContextTranslateCTM(context,0,imageSize.height);
CGContextScaleCTM(context, 1.0, -1.0);
UIGraphicsPushContext(context);

// Inset the text rect then draw the text
CGRect textRect = CGRectMake(4, 2, imageSize.width - 8, imageSize.height - 8);
UIFont *font = [UIFont boldSystemFontOfSize:24];
[[UIColor whiteColor] set];
[text drawInRect:textRect withFont:font
lineBreakMode:UILineBreakModeTailTruncation alignment:UITextAlignmentCenter];

// Create and return the UIImage object
CGImageRef cgImage = CGBitmapContextCreateImage(context);
UIImage *uiImage = [[UIImage alloc] initWithCGImage:cgImage];
UIGraphicsPopContext();
CGContextRelease(context);
CGImageRelease(cgImage);
return uiImage;
}

Note: This is a repost of this

iPhone developement – Beginner’s Tutorials

Part 1:  Kickoff iPhone Development
This presentation tells the environment requirements and basic necessities to start with iPhone App Development.
Slideshare:

Part 2: A Closer Look
This session will give a brief introduction to memory management and a closer look to APIs and components
Slideshare:

Part 3: More than UI
This session deals with the APIs in Foundation framework.
Slideshare:

Horizontal UIPickerView

A situation can arise when you want to have some horizontal UIPickerView in your application.

Something like what in the picture shown below

horizontal_pickerview

Following code will draw one like that..

-(void)loadView:{
// Write code to create self.view
// Then...
pickerViewArray = [[NSArray arrayWithObjects:
 @"John Appleseed", @"Chris Armstrong", @"Serena Auroux",
 @"Susan Bean", @"Luis Becerra", @"Kate Bell", @"Alain Briere",
 nil] retain];
 myPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero];
 myPickerView.delegate = self;
 myPickerView.showsSelectionIndicator =YES;
 myPickerView.backgroundColor = [UIColor clearColor];
 CGAffineTransform rotate = CGAffineTransformMakeRotation(-3.14/2);
 rotate = CGAffineTransformScale(rotate, 0.25, 2.0);
 [self.myPickerView setTransform:rotate];
 [self.view addSubview:myPickerView];
} 

// UIPickerViewDelegate

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
	CGRect rect = CGRectMake(0, 0, 120, 80);
	UILabel *label = [[UILabel alloc]initWithFrame:rect];
	CGAffineTransform rotate = CGAffineTransformMakeRotation(3.14/2);
	rotate = CGAffineTransformScale(rotate, 0.25, 2.0);
	[label setTransform:rotate];
	label.text = [pickerViewArray objectAtIndex:row];
	label.font = [UIFont systemFontOfSize:22.0];
	label.textAlignment = UITextAlignmentCenter;
	label.numberOfLines = 2;
	label.lineBreakMode = UILineBreakModeWordWrap;
	label.backgroundColor = [UIColor clearColor];
	label.clipsToBounds = YES;
	return label ;
}

Courtesy: Syed Yusuf

Email syntax validation -iPhone Programming

Understanding that iPhone SDK dont support NSPredicate which is there for MAC Apps SDK i wrote an Utility Method to do a syntax validation of email.

-(BOOL)validateEmail:(NSString*)email

if( (0 != [email rangeOfString:@"@"].length) &&  (0 != [email rangeOfString:@"."].length) )
	{
		NSMutableCharacterSet *invalidCharSet = [[[[NSCharacterSet alphanumericCharacterSet] invertedSet]mutableCopy]autorelease];
		[invalidCharSet removeCharactersInString:@"_-"];

		NSRange range1 = [email rangeOfString:@"@" options:NSCaseInsensitiveSearch];

		// If username part contains any character other than "."  "_" "-"

		NSString *usernamePart = [email substringToIndex:range1.location];
		NSArray *stringsArray1 = [usernamePart componentsSeparatedByString:@"."];
		for (NSString *string in stringsArray1) {
			NSRange rangeOfInavlidChars=[string rangeOfCharacterFromSet: invalidCharSet];
			if(rangeOfInavlidChars.length !=0 || [string isEqualToString:@""])
				return NO;
		}

		NSString *domainPart = [email substringFromIndex:range1.location+1];
		NSArray *stringsArray2 = [domainPart componentsSeparatedByString:@"."];

		for (NSString *string in stringsArray2) {
			NSRange rangeOfInavlidChars=[string rangeOfCharacterFromSet:invalidCharSet];
			if(rangeOfInavlidChars.length !=0 || [string isEqualToString:@""])
				return NO;
		}

		return YES;
	}
	else // no '@' or '.' present
		return NO;

UIAccelerometer

I started incorporating the accelerometer events in my app.
My app is quite similar to the
SampleDrillDown (one of the example app provided by apple). I am having menus in my app, which are like
Category -> Sub category -> final item page

All the above navigations are through pushing view controllers.

I am trying to add accelerometer delegate methods to select any of the cell in tableview on tilting the device up or down, moreover tilting right will push the view controller and tilting left will pop.

  • My concern is about how to set delegate for UIAccelerometer for such an implementation? 
  • Also the method like “selectCellAtIndexPath” will simply highlight the cell, so i want to call UITableView’s delegate method  “didSelectRowAtIndexPath” explicitly. ( to push corresponding viewcontroller)

I don’t think there is much harm in doing so..
But i would like to hear from someone who implemented this in much better way…

Checkout an abstract sample code