
From humble beginning my ultimate work finally commences! It may be a blank template with no more than an Icon to show for it, but the life-saving app is finally seeing the light of day.
CGFloat default_view_height;
// Store the UIView height to restore it if the iAd disappearswhere my_view is the outlet for the UIView you wish to expand.
default_view_height = my_view.frame.size.height;
// Since the iAd starts hidden, make the UIView full-sizedwhere iad_view is the outlet for your iAd.
my_view.frame = CGRectMake(my_view.frame.origin.x,
my_view.frame.origin.y,
my_view.frame.size.width,
iad_view.frame.origin.y +
iad_view.frame.size.height -
my_view.frame.origin.y);
- (void) bannerViewDidLoadAd:(ADBannerView *) banner {
// Shrink web view to allow iAd space
my_view.frame = CGRectMake(my_view.frame.origin.x,
my_view.frame.origin.y,
my_view.frame.size.width,
default_view_height);
iad_view.hidden = NO;
}
- (void) bannerView:(ADBannerView *) banner didFailToReceiveAdWithError:(NSError *) error {
iad_view.hidden = YES;
// Expand web view to fill space
my_view.frame = CGRectMake(my_view.frame.origin.x,
my_view.frame.origin.y,
my_view.frame.size.width,
iad_view.frame.origin.y +
iad_view.frame.size.height -
my_view.frame.origin.y);
}
cd build/Distribution-iphoneosreplacing YourAppName with the name of your App. This puts a file called YourAppName.zip in your project's root folder. Now, when you start Application Loader you will see your zip file in black and you will be able to select it for upload. Hooray, now the long and nervous wait: will they accept my App?
zip -yr ../../YourAppName.zip YourAppName.app
Lothar Collatz was born 6 July 1910 in Amsberg, Westphalia. During his post-doctoral studies at at the age of 27, Collatz developed what is now known as the Collatz Conjecture.
Simply stated, the Collatz Conjecture is defined in terms of the predicted properties of a rudimentary function.
We define Collatz's function, f, as:
for any positive starting integer n, the conjecture states that repeated iterations of this function will always lead to the cycle { 4, 2, 1 }. In other words, repeatedly applying this function to some starting number will in the long run cause the number
to become smaller and that there are no other cycles in the sequence besides { 4, 2, 1 }. To this day, no-one has been able to fully prove this conjecture holds true for all natural numbers but clearly it has for every number as yet tested. Do you think you can find the exception that will prove Lothar wrong?
The inverse function, f-1, is defined as the sequence moving backward from an ending integer through to some initial starting integer that would eventually arrive at the number entered through a series of forward iterations. It is defined as follows:
This application was written by Jeffrey C. Jacobs and is Copyright ©2010 TimeHorse, LLC; source code is available upon request.
To use Lothar, you enter a number into the edit box using the keypad provided and then hit the next to precede through successive values in the Collatz numeric sequence. To follow the sequence in reverse, activate the reverse switch and click the previous button through successive iterations. Occasionally, when viewing the previous numeric values in the Collatz sequence, a multiply button will appear. Where as normally this number could have been arrived at by taking an odd number, multiplying by 3 and adding 1, it's also possible that number was arrived at by dividing some number by 2. By default, previous always selects the first option; select multiply to select the second.
Clicking on the i will take you to the about screen where you can learn more about the Collatz algorithm and about the man who first described it, Lothar Collatz. The about page is a built-in web browser with forward, back and reload buttons. When a page is loading, the reload button becomes as stop button to stop the action. There is also a home button to take you back to the original about screen. Note the about page is stored within the application and does not need to use the Internet to retrieve data. However, clicking links on the about page will load external data to the applications web browser.
If you have any support questions, please ask them here and I shall try to address them as quickly as possible.
- (IBAction) onInfo:(id) sender;Right before the @end is a good place to put it.
- (IBAction) onInfo:(id) senderWe will provide the implementation for this shortly.
{
}
- (IBAction) onDone:(id) sender;Right before the @end is a good place to put them.
- (IBAction) onDone:(id) sender
{
// Tell the parent window to close this window
[self.parentViewController dismissModalViewControllerAnimated: YES];
}
- (IBAction) onInfo:(id) sender
{
// Create a new Info View
InfoViewController *info = [[InfoViewController alloc] init];
// Display the newly created view window
[self presentModalViewController: info animated: YES];
// Free the reference to the newly created window so that it can be managed by the OS
[info release];
}
Congratulations! You now have a working information page for your app!
I leave it as an exercise for the reader with respect to loading the text of the Info Page into your about UITextView widget dynamically and how to implement a full web-browser for your credits with the help of a UIWebView widget. Look for the answers in a future tutorial.