Saturday, September 22, 2012

iPhone 5 graphics default / splash image size and name

Hey geeks!

A new big screen iPhone device (iPhone5) is now in the market, To support this 1/2" bigger screen apple recommends (Following is the Email I received):
"If you are updating your app for iPhone 5 and iPod touch (5th generation), you must provide additional screenshots to support the new screen dimensions for the App Store."

The new screenshot dimensions are:

640 x 1136 (portrait)
640 x 1096 (portrait)
1136 x 640 (landscape)
1136 x 600 (landscape)

To support default splash on retina and non-retina display older iPhone devices, we used to have default.png (320px X 480 px) and default@2x.png (640px X 960px), To support iPhone 5, now we need to add an image of size 640px x 1136px in your resources folder.

name:  Default-568h@2x
Size :  640px x 1136px

Hope this helps!

note: Make sure It meets apple guidelines as well. Its just a information and update to help you guys with my personal notes/knowledge I gain by learning.

Saturday, June 30, 2012

iPhone popover overlay view over navigation controller bar issues & fixes

I was trying to add a popover view to my iPhone app, To get this done there is a nice and popular solution
(i.e.  popover implementation for iPhone with same API as the UIPopoverController for the iPad)
While adding it on navigation controller bar, I found 2 issues:

Issue #1:  It was not appearing on app launch but on app resume.
Solution : In WEPopOverController controller class

- (void)presentPopoverFromRect:(CGRect)rect  inView:(UIView *)theView   permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated {}

change  from [keyView addSubview:backgroundView];
to [theView addSubview:backgroundView];

Issue #2. It was hidden behind nav bar.
Solution : With Instance of WEPopoverController, presentPopoverFromRect:inView:permittedArrowDirections:animated:, Instead of presenting it in self.view I have presented it further up in the view hierarchy (I did in self.view.window)

Tuesday, May 22, 2012

iPhone | Problems with NSURLConnections to Run consecutively (in parallel)

I was trying to get multiple NSURLConnections (async) to run in sequence (consecutively).

The first call worked well (made request & fetched response) while on new async call from "connectionDidFinishLoading" (fyi, I was in a situation that based on first call response) the next call connection doesn't seem to work, as none of the NSURLConnection delegate methods are triggered.

Background threads don't automatically have an active run loop on them. You need to start up the run loop after you create the NSURLConnection in order to get any input from it. Fortunately, this is quite simple:
[[NSRunLoop currentRunLoop] run];
The default mode of NSURLConnection is asynchronous -- it creates and manages a new background thread for you, and calls back to the delegate on the original thread. You therefore don't need to worry about blocking the main thread.

Hope it will work for you, cheers!

Tuesday, May 15, 2012

iPhone | Change Section header in UITableView

Go for it!
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection: (NSInteger)section {

if ([self tableView:tableView titleForHeaderInSection:section] != nil) {
return 22;
// If no section header title & header needed
return 0;


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];

if (sectionTitle == nil) {
return nil;
// Create label with section title
UILabel *label = [[[UILabel alloc] init] autorelease];
label.frame = CGRectMake(0, 0, 320, 18);
label.backgroundColor = ANY_COLOR_OR_IMAGE_PATTERN;
label.textColor = [UIColor whiteColor];
label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0.0, 1.0);
label.font = [UIFont boldSystemFontOfSize:14];
label.text = sectionTitle;

// Create header view and add label as a subview
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, SectionHeaderHeight)];
[view autorelease];
[view addSubview:label];

return view;

Test with iOS 5 as well.. please!
Let me know if any issue.. thanks!

gson error in android application while JSON parsing | type mismatch JSON error with gson

While developing an android app having loads of usage of JSON (actually REST server based), We decided to go ahead with GSON library(I think pretty awesome except following issue).

issue : It worked fine on all android phones (fyi.. tested on few Motorola,Samsung and HTC devices..) except the HTC Explorer(a good Value for money phone as a testing device even for personal usage).

btw, error was in JSON parsing (library).. and While I was trying to run,..YUCK! I was getting a "Force Close" with some type mismatch JSON based error!

The "fix" of renaming the gson package with jarjar did the trick..
If anyone else has this problem, here's a quick solution; (fyi, we are using gson 1.6)
Steps - how-to fix it:

1) Download jarjar (
2) Put jarjar-1.0.jar and gson-1.6.jar in the same folder
3) Create a new text file in this folder (rules.txt)
4) Write the following line in the textfile: rule**
5) From the command line, open jarjar with the command "java -jar jarjar.jar process rules.txt gson-1.6.jar myjson-1.6.jar"
6) Replace the gson library in your project with myjson and update the imports

so what was the reason.. OOuch! many of the android devices (probably the HTC, as I observed) use GSON library for internal apps... this is what I know.. not sure :) ..

Droid guys! Stay tuned for more bugs..ah! solutions ;)

Tuesday, March 6, 2012

Eclipse – Your project contains error(s), please fix them before running your application.

Today I got trapped in a really weird situation. while compiling an android app in eclipse,I got alerts Your project contains error(s), please fix them before running your application.
ACTUALLY there was no error in code; I tried project -> clean. TOUGH LUCK :(
I was pretty annoyed, because I was not able to run my app to test on my Android device.
After doing a lot of investigation:

I got that this is a little annoyance you’re going to get now and then. To fix it, just use the “Problems” window which is docked at the bottom by default, right click on the Error(s) listed and delete.

Try to run now. Yay! Its running now...

If still any issue, might be you need to run project - clean.

Hope this helps!

Tuesday, January 17, 2012

iPhone | Getting touch event in UIScrollView Or scrollable UITableView

Unable to get tap event in scrolling view or scrollable table view?

hmm... Really a bad situation.. by the way here is the solution :)

Put this in viewDidLoad method :

(YOUR_SCROLL_VIEW may be UIScrollView or scrollable UITableView)

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGestureCaptured:)];

[YOUR_SCROLL_VIEW addGestureRecognizer:singleTap];

and you will get the touches with :

- (void)singleTapGestureCaptured:(UITapGestureRecognizer *)gesture {

CGPoint touchPoint=[gesture locationInView:YOUR_SCROLL_VIEW];

NSLog(@"Touch point coordinates are : %f - %f", touchPoint.x , touchPoint.y );


this worked for me, hope this helps to save your time!