Jourdein

I code, I experienced, I blog and I share my enthusiasm

RSS
people

Submitting app to App Store

images.jpgReally… it was really a tricky tasks making sure that your app is codesign correctly and Apple website accepted your app. As I could remember, I repeat myself more than 7 times doing the same thing, making sure that I did the steps correctly or when changes require you to start from the beginning.

In a simple understanding flow of process, you need to:

1. Create a request for certificate
2. Install the certificate
3. Create App Id
4. Create Provisioning profile
5. Download Provisioning profile
6. Setting XCode to CodeSign using the certificate.
7. Get the binary file, zipped it and upload to Apple website.

So, your target is to get the binary file (.app). That .app file must be signed by XCode using certificate given by Apple. The signing process also requires that you have a valid provisioning profile which you get from Apple, generated from the certificate you’ve requested.

No Comments | Tags: , ,

Wordpress plugin and iPhone app

Default_250x375.shkl.png test_ur_westness.png
wordpress_plugin.png
wp_plugin.png

Successfully finish a wordpress plugin for simple book order and an iPhone app for simple Q&A test.

No Comments | Tags: , , ,

Sliding UITextFields visible when keyboard appear

When keyboard visibleBefore keyboard visible



I thought there was an easy way such as enabling it in IB but seem I had to go to Google to find out how. For those who want to know how, here’s the original source.

Mainly, the codes involve on delegate functions:

- (void)textFieldDidBeginEditing:(UITextField *)textField
- (void)textFieldDidEndEditing:(UITextField *)textField

So, here’s the codes

1
2
3
4
5
static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3;
static const CGFloat MINIMUM_SCROLL_FRACTION = 0.2;
static const CGFloat MAXIMUM_SCROLL_FRACTION = 0.8;
static const CGFloat PORTRAIT_KEYBOARD_HEIGHT = 216;
static const CGFloat LANDSCAPE_KEYBOARD_HEIGHT = 140;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
- (void)textFieldDidBeginEditing:(UITextField *)textField {
   [UIView beginAnimations:nil context:NULL];
   [UIView setAnimationBeginsFromCurrentState:YES];
   // the setAnimationBeginsFromCurrentState allow smooth transition
   // to new text field if the user taps on another
   [UIView setAnimationDuration:0.3];
 
   CGRect textFieldRect = [self.view.window convertRect:textField.bounds
                                               fromView:textField];
   CGRect viewRect = [self.view.window convertRect:self.view.bounds
                                               fromView:self.view];
 
   CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height;
   // find the midline of textfield
   CGFloat numerator = midline - viewRect.origin.y - MINIMUM_SCROLL_FRACTION
                       * viewRect.size.height;
   CGFloat denominator = (MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION)
                       * viewRect.size.height;
   CGFloat heightFraction = numerator / denominator;
 
   if (heightFraction < 0.0) { heightFraction = 0.0; }
   else if (heightFraction > 1.0) { heightFraction = 1.0; }
 
   animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT*heightFraction);
   self.view.frame = CGRectMake(self.view.frame.origin.x,
   self.view.frame.origin.y-animatedDistance,
   self.view.frame.size.width,
   self.view.frame.size.height);
   [UIView commitAnimations];
}
1
2
3
4
5
6
7
8
9
10
11
12
13
- (void)textFieldDidEndEditing:(UITextField *)textField
{
    CGRect viewFrame = self.view.frame;
    viewFrame.origin.y += animatedDistance;
 
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
 
    [self.view setFrame:viewFrame];
 
    [UIView commitAnimations];
}

However, you could also refer to UICatalog example which also has example quite similar to this one but I prefer this one.

No Comments | Tags: , , , ,

Hide keyboard when a field lost focus

I’ve found 2 ways, currently, on how to hide keyboard when textfield lost focus on when user has done editing.

  • Delegate method
  • Callback for the event nbsp;nbsp;Did End On Exit

Delegate method

1
2
3
4
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
	[textField resignFirstResponder];
	return YES;
}

Very simple indeed. Just add this function in view where you want textfield to be delegated to.

Callback for event Did End On Exit

Outlines:

  • Create dummy method: -(IBAction)endEditing:(id)sender;
  • Connect event codeDid End On Exit/code to the dummy method created

References:

No Comments | Tags: , , , ,

Radio Button to UISegmentedControl

There’s no radio button in XCode for iPhone. Following good design practices, if you have 3 or 4 options, it is good to show it all rather than putting in drop down menu. It it is on web application, you can do it as radio button but if for application in iPhone, there is no radio button. However, there’s UISegmentedControl that function as in radio button.

Radio Button for Web App on iPhone

Radio Button for Web App on iPhone

UISegmentedControl

UISegmentedControl

Now, have to convert all algorithm from javascript to objective-c for iphone app. However, I want to test it, rather on iphone simulator, on real iphone but there’s other restrictions to it… “Code Signing”, “IDP (IPhone Developer Program). I did found the workaround but didn’t try yet.

What you need:

  • Jailbreak iPhone
  • Link-Identity-Editor..
  • Certificate..Code Signing or what-not.
  • etc..etc.

Here’s the link for detailed instructions. Better read there coz I don’t applied it yet. You’ll need to read about Code Signing Identify.

Here is another reference but seemed to not work but I think it just missed steps. The other steps is good for reference.

No Comments | Tags: , , , ,

No Radio button for iphone app

Found that there’s no easy way of creating radio button alike field as in web app for iPhone. In native iPhone app development, need to either use the UISegmentedControl or using UITableView with the items as cell and set the checkmark accessory type when user selects a cell.

These are some of the forum that I referred to:

If you like to use the checkbox style, you’d should look at the example from Apple Developer Connection (ADC), Accessory. You need to have access to ADC to be able to download.

In some thread in MacRumors, a member there pointed out that if you’ve 3-8 items, then UISegmentControl is a good replacement for radio buttons but for a larger number of items, UIPickerView is better. I have a small number of items thus UISegmentControl is of my choice. Hmm… let see what will happens.

Development status:

  • Know that, there’s no binding in iPhone development. You’ve to do it manually.
  • Managing different Nib is a lot more easier than in desktop application.
  • Memory management is important because we’re dealing with small system with small memory. IPhone has 20 seconds timer for respond before application force quit itself.
  • Some of things, you need to do programmatically than through IB as it more easier and less complex. (an example is building an interface with nav bar + tab bar and table view)
  • Finished with TabBarController and NavController. Now applying the algorithm to the app. The problem now is the the radio button. But I think I might have found the solution.
No Comments | Tags: , , , ,

Array Controller bounded to an Array

I was scratching my head of why the heck does the my tableview does not automatically update its data.

My binding:

NSArrayController = ACIssues
Controller Class = Issue Controller (have NSArray property subviewControllers)

ACIssues has it contentArray binded to subviewControllers’s array in Issue Controller. Somehow, changes made to the array of subviewControllers in Issue Controller does not reflect on other table which I had it binded to ACIssues.

After searching the internet, I found this

http://boredzo.org/blog/archives/2008-11-26/how-to-work-with-a-bound-to-array (open in new window)

Very good one. What it said… There’re right and wrong way to bind.

The right way is by using indexed accessors. Then, your Array Controller will see any changes you’ve made. What I did was creating indexed accessor methods.

- (void)insertObject:(id)object inSubviewControllersAtIndex:(unsigned)index {
[[self subviewControllers] insertObject:object atIndex:index];
}


- (void)removeObjectFromSubviewControllersAtIndex:(unsigned)index {
[[self subviewControllers] removeObjectAtIndex: index];
}

and calling it where I wanted to change the array.

[self insertObject:obj inSubviewControllersAtIndex:(index + 1)];
[self removeObjectFromSubviewControllersAtIndex:index];

the structure of this indexed accessor:

insertObject:(id)object inKeyAtIndex:(unsigned)index

where key is the property or in my case array that is binded to the Array Controller.

No Comments | Tags: , , , , ,