Search
Goodies

Social Networks
Designs I Like

Entries in questions (28)

Saturday
Nov032012

Customizing UINavigationBar in iOS 5 with strange behaviour

Here is a very strange iOS 5 behaviour (same in iOS 6). I'm customizing the appearance of a UINavigationBar with a UIImage as shown below.

The following code is used at application startup:

The end result is what I expect for the first 4 tabs of my UITabbar items like this:

The lighting comes from the top of the app. But, when selecting the More tab and all the other sections, the UINavigationBar look becomes flipped upside down like this:

Does somebody know why? What could be the cause of this? If you look carefully, the UIImage I'm using is actuallty flipped upside down in order to get the desired result... but when selecting the More UITabbar item and the following section, it gets displayed as it is really in the .png file but it is not the desired result as I ant the lighting to come from the top of the app.

This question was also posted on StackOverflow here: Customize UINavigationBar in iOS 5 strange behaviour

Sunday
Jan302011

Is this improvement? Comparing two designs

I'm in the final stages of building Ultimate Password Manager 3.0. People beta testing my application gave me a lot of suggestions. Here is the result. Which of those two screen do you prefer?

Before the open beta: grainy UINavigationBar and UITabbar, cell content with stripes, table sections with lighter part on the right in order to display the navigation index.

After beta testers comments and suggestions: less grainy design, better light reflection, improved table section headers, better cell background. 

Friday
Jan212011

Minimum required iOS version

On the eve of uploading a new version of Ultimate Password Manager to the App Store, I'm trying to search on how do we set the minimum iOS version required. The reason is that  UPM 3 won't run on iOS 3 from now on. The thing is, when the user get an update on his or her device, there is two things that can happen.


The first scenario: the user tap the application in the updates list and see the what's new text then hit the "Free" button. I could write a first line comment of this nature: "WARNING: iOS 3.x users, DON'T UPGRADE! Ultimate Password Manager 3.0 is for iOS 4.x users only. iOS3 is not supported. If you upgrade, the application won't load. "
The second scenario (the worst): the user hit the "Update All" button, Ultimate Password Manager is downloaded then installed on the unsupported device without any warning. The user is not happy. This is the worst case scenario as the user cannot see the warning.
Using Xcode Base SDK setting (which must be always at the highest level) and Deployment Target at the minimum targeted iOS version required (in my case this is iOS 4.0) doesn't solve the problem; it seems that setting the Target at iOS 4 will set for us an info.plist key called "MinimumOSVersion". iTunes Connect don't seems to take this into account and while uploading a new binary, there is no place to set a similar value. So I'm stuck with a potential problem for my users. What can I do about it?

First, on the application's web site that the user can visit from the app, I can write a post about the minimum requirements for the upcoming release. Diligent users will get the message. 
Second, on the application's marketing web site we can add a similar note. But, I fear this isn't enough to prevent iOS 3.x users upgrade to UPM 3.0. And it seems this is as far as I can get to warn my users. 

Thursday
Dec092010

Xcode 3.2.5 so CPU intensive!

I wonder why after opening Xcode 3.2.5 it goes through a very CPU intensive period for about 2-3 minutes.

Thursday
Dec022010

UITableView: using custom section title background - Part III

Bugs can be complex to resolve... or very simple. In my last post "UITableView: using custom section title background - Part II", I exposed a bug with a UILabel not being set as expected while building a UIView containing it. I was using the exact same process for this view for section header that needs to be built and returned from a UIViewTable delegate methods as I was doing to build custom made UIViewTableCell. So what was the problem? See the following line of code:


viewToReturn.sectionTitle = [arrayOfCharacters objectAtIndex:section];

What it does is this: assign a string pointer from the index "arrayOfCharacters" to the sectionTitle property. The problem is: the assignment should have been like this:

viewToReturn.sectionTitle.text = [arrayOfCharacters objectAtIndex:section];

Now the UILabel is set correctly. I found out this problem while compiling this line:
The compiler says it is expecting a UILabel (from the property definition), not a NSString. That is the problem, I'm missing the .text property of the UILabel and this is why the UILabel was not being set.

Another bug behind me this morning. I'm always very efficient in the morning, much more than any other part of the day.

Tuesday
Nov302010

UITableView: using custom section title background - Part II

In a previous post, I wanted to create a custom UIView for table view section header. The one created by Apple is nice but I wanted to do something different. I encountered a problem: views we're recycled while scrolling the table. To fix my problem described in the first post, I decided to proceed as follow:

  1. Create a .xib file in Interface Builder that includes a UIView and a UILabel
  2. Create a "sectionHeaderForTable.h / sectionHeaderForTable.m" class definition file with a IBOutlet and a property for the UILabel
  3. Set the UIView in the .xib file to class "sectionTitleHeader"
  4. Create the link from the UIView to the UILabel
Note:
  1. The file's Owner is not modified as this is not a UIViewController that owns this
  2. The only change made to the .m file is to add a @synthesize for the UILabel
  3. This process allows the creation of an instance of UIView different from each table sections thus fixing the recycled view problem. 
Now, the code to return the header view in the viewForHeaderInSection delegate method is:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
 
sectionTitleForTable *viewToReturn = nil;
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"sectionTitleForTable" owner:self options:nil];
for (id currentObject in topLevelObjects){
if ([currentObject isKindOfClass:[UIView class]]){
viewToReturn =  (sectionTitleForTable *) currentObject;
break;
}
}
viewToReturn.sectionTitle = [arrayOfCharacters objectAtIndex:section];
    return viewToReturn;
}

As you can see, this is a very common way of doing UIView loading from a .xib file. I'm doing exactly the same process for return UITableViewCell with UILabel for fields like the following one:
But, for some reason, the UILabel never get initialized to the value passed by:

viewToReturn.sectionTitle = [arrayOfCharacters objectAtIndex:section];

If you happen to have an idea, feel free to drop a line in the comment! Thanks.  

Monday
Nov292010

Three20: waiting for better documentation

Well, I decided to leave Three20 on the side for a while. I'm not alone complaining about the lack of documentation for this library of classes. So I decided to convert my UITextField to a UITextView instead of using TTTextEditor. The result is exactly what I wanted: allow users to enter multi-line of text in this field.

How did I create the rounded frame around the UITextView? With PixelMator I took the standard UITextField box that I stretched on the vertical. This may be not optimal as I will have to create a version for the retina display but, for now that will do the trick.

Monday
Nov292010

UITableView: using custom section title background

In a plain UITableView containing sections (for example: one section for each alphabet letter in a indexed table), we can use the Apple's default section title background view or we can build our own. This is what I'm trying to do.

Apple's default section title views
The new section title views will look like this one:
This version is darker, textured, smaller and provide a lighter background at the right for a better display of the table's index. The implementation I made is very simple: in Interface Builder, I made a UIView will a UIImageView and a UILabel on top of it with the desired text attributes. In code, I've added IBOutlet for the UIView and for the UILabel itself as it will change for each section of the table. Two delegate methods were implemented: heightForHeaderInSection and viewForHeaderInSection which follows:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 18.0;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    sectionTitle.text = [arrayOfCharacters objectAtIndex:section];
    return tableSectionHeaderBackground;
}

The display of the table works perfectly. The problem is this: the scrolling. As soon at the table displays two sections at the same time, one of the section header is not displayed. The views are recycled. The sections are missing except the last one. 
The code is very simple, but how can this be fixed? Answer on the blog post forum would be really appreciated. 

Wednesday
Nov032010

Weird: out of bound access without runtime error

How could this be possible. Look at this line of code:

[defaults setInteger:[[[searchResults objectAtIndex:entryToEdit] objectForKey:kpwdEntryID] integerValue] forKey:kpwdEntryID];

When running, the application doesn't crash and returns to the main event loop. In the debugger, stepping at this line create a delay then returns normally running the application. Looking at the Console, here is what I found:


2010-11-03 19:49:11.368 uPasswords[79217:207] CoreAnimation: ignoring exception: *** -[NSMutableArray objectAtIndex:]: index 1 beyond bounds [0 .. 0]

An out of bound access to an NSMutableArray without producing a runtime crash. How could this be happening?

Monday
Feb152010

Adhoc install with purchased version on same device

I have a problem that I want to address. I'm using an iPod touch 1gen as a development device and I have an iPhone 3GS as my phone where I bought my own software uP@ssw0rdz! (hey, my application is the best password manager !).

The question is, what if I want to test an AdHoc build of my application on my iPhone 3GS without removing my purchased version ?

I hear that simply renaming the CFBundleIdentifier in the info.plist and building an AdHoc build is enough. Is that right ?

Thanks for your help !