Radio buttons for iPhone application

Presented simple and nice solution for radio buttons, based on the UIButton.

Add buttons on view of controller

  1. for (int i = 0; i < 5; i++) {
  2.         UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
  3.         [but setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
  4.         [but setImage:[UIImage imageNamed:@"checkedbox.png"] forState:UIControlStateSelected];
  5.         [but setFrame:CGRectMake(0, 0, 17, 17)];
  6.         [but setCenter:CGPointMake( 50,  i*40+20 )];
  7.         [but addTarget:self action:@selector(checkboxButton:) forControlEvents:UIControlEventTouchUpInside];
  8.         [self.view addSubview:but];
  9.     }

Action for buttons:

  1. - (IBAction)checkboxButton:(UIButton *)button{
  2.    
  3.     for (UIButton *but in [self.view subviews]) {
  4.         if ([but isKindOfClass:[UIButton class]] && ![but isEqual:button]) {
  5.             [but setSelected:NO];
  6.         }
  7.     }
  8.     if (!button.selected) {
  9.         button.selected = !button.selected;
  10.     }
  11. }

you can will get UI from here

good luck!

Tags: , , , , , , , , | Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Loading ... Loading ...

How to launch AppStore application with request?

If you will need launch AppStore application with search request – use this example

  1. NSString *str = @"itms-apps://ax.search.itunes.apple.com";
  2.     str = [NSString stringWithFormat:@"%@/WebObjects/MZSearch.woa/wa/search?media=software&term=", str];
  3.     str = [NSString stringWithFormat:@"%@3d4medical", str];
  4.    
  5.     [[UIApplication sharedApplication] openURL: [NSURL URLWithString:str]];

for getting reviews screen of application, you can will use this example:

  1. NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
  2.     str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str];
  3.     str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];
  4.    
  5.     // Here is the app id from itunesconnect
  6.     str = [NSString stringWithFormat:@"%@325180061", str];
  7.     [[UIApplication sharedApplication] openURL: [NSURL URLWithString:str]];

for getting screen of application:

  1. NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
  2.     str = [NSString stringWithFormat:@"%@/wa/viewSoftware?id=", str];
  3.    
  4.     // Here is the app id from itunesconnect
  5.     str = [NSString stringWithFormat:@"%@325180061", str];
  6.     [[UIApplication sharedApplication] openURL: [NSURL URLWithString:str]];

Tags: , , , , , , | Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)

Loading ... Loading ...

convert iPhone xib to iPad/iPhone xib

Tags: , , , , , , , | Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Loading ... Loading ...

Samples code for iPad development from apple

ToolbarSearch

This sample shows how to use a search field in a toolbar. When you start a search, a table view displaying recent searches matching the current search string is displayed in a popover.

New controller:

  1. UIPopoverControllerDelegate

Create a navigation controller to contain the recent searches controller, and create the popover controller to contain the navigation controller.

  1. UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:recentSearchesController];
  2.    
  3.     UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:navigationController];
  4.     self.recentSearchesPopoverController = popover;
  5.     recentSearchesPopoverController.delegate = self;

[Read more...]

Tags: , , , , , , , | Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Loading ... Loading ...

Many information about development for iPad in one place

From Apple Site

Xcode/Developer Tools

  • Changing an iPhone Executable’s working directory from “Build Products directory” may cause the application not to install properly with the error message “The Info.plist for application at (null) specifies a CFBundleExecutable of (null), which does not exist.”
  • You may only use .png files for application icons for the device.
  • The iPhone SDK is designed for Intel-based Macs and is not supported on PPC-based Macs.
  • When running and debugging on a device, be sure to turn off Passcode lock.
  • Trying to debug two applications at the same time on the same device fails with a broken pipe error in the debugger console.

Core Graphics

  • CGFontCreateWithFontName can hang in some circumstances when using the UIAppFonts key in the Info.plist.

Interface Builder

  • To support external localization tools and workflows, Interface Builder 3.2.2 supports an option to save iPhone documents in an editable NIB format. Additionally, the Xcode build settings “Flatten Compiled XIB Files” and “Strip NIB Files” now apply to iPhone Interface Builder documents in the same way they apply to Mac OS X documents. By default, NIB files will be stripped when built.
  • iPhone OS 3.2 supports loading unstripped NIB files, but iPhone OS releases prior to 3.2 do not. If you choose to build unstripped NIB files to support a localization workflow, you should either use ibtool’s –strip command to strip NIB files after localizing, or temporarily revert the “Flatten Compiled XIB Files” and “Strip NIB Files” build settings to build NIBs compatible with previous iPhoneOS releases.
  • Building an iPhone application that uses UITableViewCell objects encoded in XIB files and then running that application in the simulator or on a device with a version less than 3.2 will result in a runtime exception. To workaround this, use the simulator with the 3.2 SDK.

Launch Services

  • The Info.plist key CFBundleIconFiles is not working properly.
  • UIDocumentInteractionController is not yet fully functional.

MapKit

  • Previously, directions URLs were handed as a single point-to-point request. In iPhone OS 3.2, it is handled as 2 sets of search queries and results, which can be run concurrently. The Maps UI for spellchecking, refinements and map pan/zoom now support concurrent searches.

MediaPlayer

  • If an MPMoviePlayerController object is set to full screen before calling presentMoviePlayerViewControllerAnimated:, the movie will not properly play fullscreen.
  • The simulator window incorrectly rotates to portrait when an MPMoviePlayerController object enters fullscreen from landscape.
  • The MPMoviePlayerPlaybackDidFinishNotification notification is not sent from the Done button when a movie is launched non-fullscreen and switched to fullscreen.
  • An MPMoviePlayerController object does not behave properly when content is programmatically changed.
  • Exiting fullscreen mode of an MPMoviePlayerController object’s movie does not return the movie to its view frame.

MessageUI

  • The Message UI framework exports class names without prefixes, which can cause namespace confusion. If you are using the Message UI framework, watch for compiler warnings about duplicate symbols. To avoid namespace issues, you can add prefixes to your own class names.

Simulator [Read more...]

Tags: , , , , | Author: Vladimir Boychentsov

2 comments

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Loading ... Loading ...

Today is my and my girlfriend Birthday!

| Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Loading ... Loading ...

Use Matrix of rotate +MozOrientation

Previous post is simple example of usage MozOrientation. But now i use Matrix of rotate and i have nice animation.

You can read many information about Matrix of rotate here. These methods are used in game development, make animations and many others.

  1. var context = drawingCanvas.getContext('2d');
  2.  
  3. var xc = 75;
  4. var yc = 75;
  5. var xi = 0;
  6. var yi = 0;
  7.  
  8. var myImage = new Image();
  9.  
  10. var angle = (Math.PI/2)*-o.x;
  11. myImage.onload = function() {
  12.     context.clearRect(0,0,150,150);
  13.     context.save();
  14.    
  15.     xi = xi*Math.cos(angle)-yi*Math.sin(angle)-xc;
  16.     yi = yi*Math.sin(angle)+yi*Math.cos(angle)-yc;
  17.    
  18.    
  19.     context.translate( xc , yc);
  20.    
  21.     context.rotate(angle);
  22.     context.scale(1+o.y,1+o.y);
  23.     context.drawImage(myImage, xi, yi);
  24.    
  25.     context.restore();
  26. }
  27. myImage.src = "feedme.png";

Result:

Your browser doesn’t support canvas.

Tags: , , , , , , , | Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Loading ... Loading ...

JavaScript examples for MozOrientation of FireFox 3.6

Today i present new feature of FireFox 3.6 – MozOrientation

With Canvas and MozOrientaion you will get nice web site!

Please look on my icons of Feed and Twitter! :)

My twitter source:

  1. function init() {
  2. additional_load(null);
  3.  window.addEventListener("MozOrientation", additional_load, true);
  4. }
  5.  
  6. function additional_load(o) {
  7. var drawingCanvasTwitter = document.getElementById('myDrawingTwetter');
  8.     // Check the element is in the DOM and the browser supports canvas
  9.     if(drawingCanvasTwitter && drawingCanvasTwitter.getContext) {
  10.         // Initaliase a 2-dimensional drawing context
  11.         var context = drawingCanvasTwitter.getContext('2d');
  12.    
  13.             var myImage = new Image();
  14.             myImage.onload = function() {
  15.                 context.clearRect(0,0,150,150);
  16.                 context.save();
  17.                 if(o) {
  18.                     if(o.x > 0)
  19.                         context.translate(0, 134*o.x);
  20.                     else
  21.                         context.translate(-134*o.x, 0);
  22.                 }  
  23.  
  24.                 if(o)
  25.                     context.rotate((Math.PI/2)*-o.x);
  26.                 context.drawImage(myImage, 0, 40);
  27.                 context.restore();
  28.             }
  29.             myImage.src = "http://www.developers-life.com/wp-content/uploads/2009/12/tw.jpg";      
  30.     }
  31. }
  1. <body onload="init()"></body>

Example for handle orientation:
[Read more...]

Tags: , , | Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Loading ... Loading ...

Change RGB color of the picture

Change RGB color of the picture

  1. - (UIImage *) changeColor: (UIImage *)image {
  2.     UIGraphicsBeginImageContext(image.size);
  3.    
  4.     CGRect contextRect;
  5.     contextRect.origin.x = 0.0f;
  6.     contextRect.origin.y = 0.0f;
  7.     contextRect.size = [image size];
  8.     // Retrieve source image and begin image context
  9.     CGSize itemImageSize = [image size];
  10.     CGPoint itemImagePosition;
  11.     itemImagePosition.x = ceilf((contextRect.size.width - itemImageSize.width) / 2);
  12.     itemImagePosition.y = ceilf((contextRect.size.height - itemImageSize.height) );
  13.    
  14.     UIGraphicsBeginImageContext(contextRect.size);
  15.    
  16.     CGContextRef c = UIGraphicsGetCurrentContext();
  17.     // Setup shadow
  18.     // Setup transparency layer and clip to mask
  19.     CGContextBeginTransparencyLayer(c, NULL);
  20.     CGContextScaleCTM(c, 1.0, -1.0);
  21.     CGContextClipToMask(c, CGRectMake(itemImagePosition.x, -itemImagePosition.y, itemImageSize.width, -itemImageSize.height), [image CGImage]);
  22.     // Fill and end the transparency layer
  23.    
  24.     switch (colorSelected) {
  25.         case 0:
  26.             CGContextSetRGBFillColor(c, 0, 0, 1, 1);
  27.             break;
  28.  
  29.         default:
  30.             CGContextSetRGBFillColor(c, 1, 0, 0., 1);
  31.             break;
  32.     }
  33.    
  34.     contextRect.size.height = -contextRect.size.height;
  35.     contextRect.size.height -= 15;
  36.     CGContextFillRect(c, contextRect);
  37.     CGContextEndTransparencyLayer(c);
  38.  
  39.     UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
  40.     UIGraphicsEndImageContext();
  41.     return img;
  42. }

Tags: , , , | Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Loading ... Loading ...

How to find bug in xCode project of iPhone application.

Tags: , , , , , , , , | Author: Vladimir Boychentsov

Leave a Comment

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Loading ... Loading ...

Page 1 of 1212345»...Last »