9:39 PM

UIActivity Indicator

Posted by pradeep T

- (void) createProgressionAlertWithMessage:(NSString *)message withActivity:(BOOL)activity
{
progressAlert = [[UIAlertView alloc] initWithTitle: message
message: @"Please wait..."
delegate: self
cancelButtonTitle: nil
otherButtonTitles: nil];

// Create the progress bar and add it to the alert
if (activity) {
activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
activityView.frame = CGRectMake(139.0f-18.0f, 80.0f, 37.0f, 37.0f);
[progressAlert addSubview:activityView];
[activityView startAnimating];
} else {
progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(30.0f, 80.0f, 225.0f, 90.0f)];
[progressAlert addSubview:progressView];
[progressView setProgressViewStyle: UIProgressViewStyleBar];
}
[progressAlert show];
[progressAlert release];
}

9:38 PM

UIElements Complete Tutorials

Posted by pradeep T

UITextField

Code:
UITextField *username =[[UITextField alloc] initWithFrame:CGRectMake(24.5, 65, 270, 30)];
username.delegate=self;
username.textAlignment=UITextAlignmentCenter;
username.borderStyle=UITextBorderStyleRoundedRect;
username.placeholder=@"Username\n";
username.autocorrectionType=UITextAutocorrectionTypeNo;
username.autocapitalizationType=UITextAutocapitalizationTypeNone;
[self.view addSubview:username];
UIActionSheet
Code:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"This is where the information will go"
delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil
otherButtonTitles:@"Email", @"Tech Support",@"Website",@"Cancel", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
actionSheet.destructiveButtonIndex = 3; // make the second button red (destructive)
[actionSheet showInView:self.view];
[actionSheet release];
Selecting a button on UIActionSheet
Code:
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0){
// do stuff
}
}

UISwitch
Code:
UISwitch *switchIt = [[UISwitch alloc] initWithFrame:CGRectZero];
switchIt.on=NO;
[self.contentView addSubview:switchIt];
UILabel
Code:
UILabel *usernameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
usernameLabel.text=@"Personal Location Checkin";
usernameLabel.adjustsFontSizeToFitWidth=YES;
[self.contentView addSubview:usernameLabel];
UISearchBar
Code:
UISearchBar *mySearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, 45)];
mySearchBar.delegate = self;
mySearchBar.showsCancelButton = YES;
mySearchBar.barStyle=UIBarStyleBlackOpaque;
mySearchBar.placeholder=@"Enter Name or Phone Number";
mySearchBar.keyboardType=UIKeyboardTypeNamePhonePad;


[self.view addSubview: mySearchBar];
UIView
Code:
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor grayColor];
self.view = contentView;
[contentView release];
UITableView
Code:
UITableView *myBeaconsTableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0, 45, self.view.bounds.size.width, 375)];
myBeaconsTableView.delegate=self;
myBeaconsTableView.dataSource=self;

[self.view addSubview:myBeaconsTableView];
Or to make a grouped table view (like in preferences)

Code:
UITableView *settingsTableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0, 40, self.view.bounds.size.width, 375) style:UITableViewStyleGrouped];
settingsTableView.delegate=self;
settingsTableView.dataSource=self;
[self.view addSubview:settingsTableView];
UINavigationBar
Plain no Title
Code:
myNavBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, 45)];
[self.view addSubview:myNavBar];
Black Opaque (no title)
Code:
myNavBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, 45)];
myNavBar.barStyle=UIBarStyleBlackOpaque;
[self.view addSubview:myNavBar];
Black Translucent (no title)
Code:
myNavBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, 45)];
myNavBar.barStyle=UIBarStyleBlackTranslucent;
[self.view addSubview:myNavBar];
To add title and other buttons

Code:
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:@"Around Me"];
[myNavBar pushNavigationItem: navItem];
To add buttons with image
Code:
refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(action:)];
[navItem setLeftBarButtonItem:refreshButton];
Add button with Text
Code:
refreshButton = [[UIBarButtonItem alloc] initWithTitle:@"About Us" style:UIBarButtonItemStyleBordered target:self action:@selector(action:)];
[navItem setRightBarButtonItem:refreshButton];
How to add comments
Code:
When you want to add a comment about a line of code you do this

// Comment

To do a multi-lined comment you would do this

/* This
is
multi-lined
comment
*/
UIWebView
Code:
dailyWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0, 45, self.view.bounds.size.width, 375)];
dailyWebView.delegate=self;
dailyWebView.scalesPageToFit=YES;
[dailyWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
[self.view addSubview:dailyWebView];
UITextView
Code:
UITextView *textView = [[[UITextView alloc] initWithFrame:frame] autorelease];
textView.textColor = [UIColor blackColor];
textView.font = [UIFont fontWithName:@"Helvetica" size:15];
textView.delegate = self;
textView.backgroundColor = [UIColor whiteColor];

textView.text = @"TEXT TO GO IN HERE";
[self.view addSubView:textView];

UISegmentedControl
Code:
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects:
[UIImage imageNamed:@"segment_check.png"],
[UIImage imageNamed:@"segment_search.png"],
[UIImage imageNamed:@"segment_tools.png"],
nil]];
frame = CGRectMake( 0,
0,
self.view.bounds.size.width,
35);
segmentedControl.frame = frame;
[segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
segmentedControl.selectedSegmentIndex = 1;
[self.view addSubview:segmentedControl];
UIAlertView
Code:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"Your message"
delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Button1", @"Button2", nil];
[alert show];
[alert release];
This is just some UI elements that can be added through code

11:04 AM

Device Orientation && UILABLE ROTATE

Posted by pradeep T

I have got my own custom UIViewController, which contains a UIScrollView with an UIImageView as it's subview. I would like to make the image to auto rotate when device orientation changes, but it doesn't seem to be working...

In the header file, I've got;

@interface MyViewController : UIViewController {
IBOutlet UIScrollView *containerView;
UIImageView *imageView;
}
These components are initialised in the loadView function as below;

containerView = [[UIScrollView alloc] initWithFrame:frame];

NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://..."]];
UIImage *image = [[UIImage alloc] initWithData:data];
imageView = [[UIImageView alloc] initWithImage:image];
[image release];

[containerView addSubview:imageView];
And I have added the following method, assuming that's all I need to make the view auto-rotate...

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
MyViewController loads fine with the image I've specified to grab from the URL, and the shouldAutorotate... function is being called, with the correct UIInterfaceOrientation, when I flip the device too.

However, didRotateFromInterfaceOrientation method do not get called, and the image doesn't seem to rotate itself... Could someone please point out what I need to add, or what I have done wrong here?


UILABLE ROTATE :

/*************************
As August said, I'm not sure of your use case on this, but there's a reasonably straightforward way to do it using Core Animation. First, you'll need to add the QuartzCore framework to your project and do a

#import
somewhere in your headers.

Then, you can apply a rotational transform to your UILabel's underlying layer using the following:

yourLabel.layer.transform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f);
which will rotate the label's CALayer by 180 degrees (pi radians) about the Y axis, producing the mirror effect you're looking for.

11:00 AM

UITAbleView -Row invisible in keypad

Posted by pradeep T

1


I faced the same situation. It is suggested that you change the height of your view when the keyboard appears. The problem in the case you've described is, there is not enough content in the tableview to scroll up and still have something in the area hidden by the keyboard.

If you adjust the size of the tableview to be equal to 480-150 (height of view - height of keyboard), and use scrollToRowAtIndexPath, it will work as expected. Once the keyboard hides again, change back the height of the tableview to the original height.

10:50 AM

UIView Flip Transition !!

Posted by pradeep T

These are the UIView parameters that can be animated:
frame
bounds
center
transform
alpha


[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:kTransitionDuration];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];

[self.view addSubview:newView];
[self.view setAlpha:0.0];
[UIView commitAnimations];


/**************************************

-(IBAction)swap:(id)sender{
//If you need to position anything and not have it animated add it before the beginAnimations block

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.6]; //The time in seconds the animation should last.

// In Interface Builder I set the tag of the first button to 1 and the second to 2.
// You could create seperate functions for both bottoms but in this case it's not needed.

if ([sender tag] == 1){
[view1 removeFromSuperview];
[window addSubview:view2];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
}
else{
[view2 removeFromSuperview];
[window addSubview:view1];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];
}

[UIView commitAnimations];
}


/****************************************

2


I think the only thing you're looking for is:

UIView's

+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache;
and

UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight,
These animation transitions can only be used within an animation block. The transition is set on the container view and then the old view is swapped out for the new view, then the animation is committed.

Like:

CGContextRef context = UIGraphicsGetCurrentContext();

[UIView beginAnimations:nil context:context];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:yourContainerView cache:YES];
[yourContainerView exchangeSubviewsAtIndex:0 withSubviewAtIndex:1];
[UIView commitAnimations];


- (void)loadFlipsideViewController {

FlipsideViewController *viewController = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
self.flipsideViewController = viewController;
[viewController release];

// Set up the navigation bar
UINavigationBar *aNavigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
aNavigationBar.barStyle = UIBarStyleBlackOpaque;
self.flipsideNavigationBar = aNavigationBar;
[aNavigationBar release];

UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(toggleView)];
UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"Test123"];
navigationItem.rightBarButtonItem = buttonItem;
[flipsideNavigationBar pushNavigationItem:navigationItem animated:NO];
[navigationItem release];
[buttonItem release];
}


- (IBAction)toggleView {
/*
This method is called when the info or Done button is pressed.
It flips the displayed view from the main view to the flipside view and vice-versa.
*/
if (flipsideViewController == nil) {
[self loadFlipsideViewController];
}

UIView *mainView = mainViewController.view;
UIView *flipsideView = flipsideViewController.view;

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:([mainView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft) forView:self.view cache:YES];

if ([mainView superview] != nil) {
[flipsideViewController viewWillAppear:YES];
[mainViewController viewWillDisappear:YES];
[mainView removeFromSuperview];
[infoButton removeFromSuperview];
[self.view addSubview:flipsideView];
[self.view insertSubview:flipsideNavigationBar aboveSubview:flipsideView];
[mainViewController viewDidDisappear:YES];
[flipsideViewController viewDidAppear:YES];

} else {
[mainViewController viewWillAppear:YES];
[flipsideViewController viewWillDisappear:YES];
[flipsideView removeFromSuperview];
[flipsideNavigationBar removeFromSuperview];
[self.view addSubview:mainView];
[self.view insertSubview:infoButton aboveSubview:mainViewController.view];
[flipsideViewController viewDidDisappear:YES];
[mainViewController viewDidAppear:YES];
}
[UIView commitAnimations];
}

/*************************************************
// Start Animation Block
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:[self superview] cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0];

//int nextView = currentView + 1;
// Animations
[[self superview] exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
//And so I would do: [[self superview exchangeSubviewAtIndex:currentView withSubviewAtIndex:nextView];
//Doesn't work because curentView is not global... with each instance of a class it's reset to what it's instanciated to.
//currentView++;

// Commit Animation Block
[UIView commitAnimations];

10:20 AM

Code Signing !! deployment of iapps

Posted by pradeep T

CodeSign error: a valid provisioning profile is required for product type ‘Application’ in SDK ‘Device - iPhone OS 2.2″
This error will appear when you update your provisioning profile in iPhone SDK 2.2
or after the expiration of developer certificate and that you have a new provisioning profile from the developer portal
This is the solution (which is modified from http://www.furmanek.net/54/iphone-sdk-22-codesign-error/)
Suppose you have copied your provisioning profile called “iPhone_Development.mobileprovision” to the Library folder and build & go an old iPhone project called “MyApp”, and this annoying error appears
(1) cd ~/Library/MobileDevice/Provisioning\ Profiles/
(2) find out the UUID of the provisioning profile
strings iPhone_Development.mobileprovision | grep ".*-.*"
output is like this
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
(3) copy that UUID between the string tag
(4) close xcode and go to your project
cd ~/Projects/MyApp/MyApp.xcodeproj
(5) Use a text editor to open the project.pbxproj
find the string PROVISIONING_PROFILE
paste the UUID that you copied from step (3) and put it in both Debug and Release Sections (do multiple finds) for the following line
e.g.
PROVISIONING_PROFILE = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
(6) Launch XCode and open the project and build & go again




This seems to be a chronic issue and is unresolved across many forums. This error occurs when you Build and Go for Device - iPhone OS 2.1 and can be verified when looking under Project Info > Build > Code Signing > Code Signing Provisioning Profile > Any iPhone Device, the name of your Provisioning Profile (ie. ITP DAP Projects) will not be listed as a Value.
I was able to resolve this issue by restoring my iPhone in Xcode under the Summary tab of the Organizer window.
Before doing so, you should of course confirm you have the Development Certificate and WWDR Intermediate Certificate in place, and have the Provisioning Profile both on your Mac under Library > MobileDevice > Provisioning Profile and on your iPhone under Settings > General > Profile

10:17 AM

UseFull Links !!

Posted by pradeep T

Blogs :
http://iappdevs.com/
http://www.iphonedevforums.com/
http://www.iphonesdkarticles.com/2008/11/parsing-xml-files.html
http://www.idevgames.com/forum/showthread.php?t=16500
http://forums.macrumors.com/showthread.php?t=629384
http://discussions.apple.com/message.jspa?messageID=7520321
http://stackoverflow.com/questions/121615/how-to-tint-a-uibutton
http://www.iphonedevsdk.com/forum/
http://www.fifthfloormedia.com/iphone-tutorial-animation-demo-1/

Mac :
http://hci.rwth-aachen.de/cocoaheads
http://stefan.hafeneger.name/2008/06/03/iphone-datamatrix-reader/
http://iphone.trac.wordpress.org/browser

coreGraphics !! buton gradient

http://cocoawithlove.com/2008/09/drawing-gloss-gradients-in-coregraphics.html

article on XML PARSING:

http://www.iphonesdkarticles.com/2008/11/parsing-xml-files.html



Codes:
http://blog.coriolis.ch/2008/11/09/add-an-uiprogressview-or-uiactivityindicatorview-to-your-uialertview/
http://www.ipodtouchfans.com/forums/showthread.php?t=102782

Sample Codes:
http://code.google.com/p/cookbooksamples/downloads/list



Topic Wise:

10:06 AM

NSArray and Sorting

Posted by pradeep T

Array declaration !!

NSArray *theSimpsons = [[NSArray arrayWithObjects:
@"Homer Jay Simpson", @"Marjorie "Marge" Simpson",
@"Bartholomew "Bart" J. Simpson", @"Lisa Marie Simpson",
@"Margaret "Maggie" Simpson",
@"Abraham J. Simpson",
@"Santa's Little Helper",
@"Ned Flanders", @"Apu Nahasapeemapetilon",
@"Clancy Wiggum", @"Charles Montgomery Burns",nil] retain];


NSArray *myarray=[NSArray arrayWithObjects:@"32", @"54",@"1", nil];
NSArray *sortedArray= [myarray sortedArrayUsingFunction:intSort context:NULL];
NSLog(@"%@",sortedArray);
}

NSInteger intSort(id num1, id num2,void *context)
{
int v1=[num1 intValue];
int v2=[num2 intValue];
if(v1<v2)
return NSOrderedAscending;
else if (v1>v2)
return NSOrderedDescending;
else
return NSOrderedSame;
}

10:01 AM

UIPickerView !!

Posted by pradeep T

#import

@interface StartUpViewController : UIViewController {
UIPickerView *accuracyPicker;
NSArray *pickerItems;
}
@property(nonatomic,retain)UIPickerView *accuracyPicker;
@end

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
pickerItems = [[NSArray alloc] initWithObjects:@"Best",@"10 \t KMS",@"20 \t KMS",@"30 \t KMS",@"40 \t KMS",nil];

}
return self;
}



// returns the number of columns to display.
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}

// returns the number of rows
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return [pickerItems count];
}

#pragma mark ---- UIPickerViewDelegate delegate methods ----

// returns the title of each row
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
NSString *currentItem = [pickerItems objectAtIndex:row];
return currentItem ;
}

// gets called when the user settles on a row
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{

NSString *currentItem = [pickerItems objectAtIndex:row];
printf("\n Accuracy set :%s",[currentItem UTF8String]);
}


- (void)viewDidLoad {
[super viewDidLoad];
UIView *mview = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
//[[UIScreen mainScreen] applicationFrame] this fits the view frame to complete secreen
accuracyPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 75, 100, 100)];
//creating the picker view
accuracyPicker.autoresizingMask = UIViewAutoresizingFlexibleWidth;
accuracyPicker.delegate = self;
accuracyPicker.dataSource = self;
accuracyPicker.showsSelectionIndicator=YES;//for showing the picker
mview.backgroundColor=[UIColor darkGrayColor];//for the background color
[mview addSubview:accuracyPicker];

self.title =@"Welcome to Hotels App";
self.view = mview;
[mview release];

}

9:58 AM

UITableView -iphone

Posted by pradeep T

this is an article about table view!!

MAKING table view GROUPED ::

tb = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStyleGrouped];

************

UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,320,440) style:UITableViewStyleGrouped];
tableView.rowHeight = 55;
[tableView setSectionHeaderHeight:5];
[tableView setSectionFooterHeight:5];

2. Setting with Delegate methods.
_______________________________________________________
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 25.0f;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 25.0f;
}
Setting with properties
___________________________________________________________
UITableView *theTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 440) style:UITableViewStyleGrouped];
theTableView.delegate = self;
theTableView.dataSource = self;
theTableView.backgroundColor=[UIColor brownColor];
UIImageView *img=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"flag_green(2).png"]];
img.frame=CGRectMake(5, 10, 5, 5);
[theTableView setTableHeaderView:img]

2. Setting with Delegate methods.
_______________________________________________________
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section // custom view for header. will be adjusted to default or specified header height
{
UIImageView *img=[[UIImageView alloc]initWithImage:myimageview];
img.frame=CGRectMake(5, 10, 10, 10);
return img;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section // custom view for footer. will be adjusted to default or specified footer height
{
UIImageView *img=[[UIImageView alloc]initWithImage:myimageview];
img.frame=CGRectMake(5, 10, 10, 10);
return img;
}

9:51 AM

UIView !!

Posted by pradeep T

This blog contains details about UIView !!


- (void)applicationDidFinishLaunching: (UIApplication *)application {

UIButton *myButton= [[UIButton alloc] init];
myButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
myButton.frame = CGRectMake(105,180, 115, 35);
[myButton setTitle:@"Apply Image" forState:UIControlStateNormal];
myButton.backgroundColor = [UIColor clearColor];
[myButton addTarget:self action:@selector(ApplyImage: ) forControlEvents:UIControlEventTouchUpInside];

[window addSubview:myButton];//So Here we keeping a button on windowthe button action is ApplyImage() methos calling
[window makeKeyAndVisible];
[myButton release];
}

-(void)ApplyImage:(id)sender
{
UIView *mview= [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

UIImageView *img=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fantasy_13.jpg"]];
img.frame=CGRectMake(0, 0, img.frame.size.width, img.frame.size.height);
[mview addSubview:img];
[img release];

UILabel *name = [[UILabel alloc]initWithFrame:CGRectMake(105,180,250,25)];
name.text = @"This is my View Example";
name.textColor=[UIColor whiteColor];
name.font=[UIFont boldSystemFontOfSize:13];
name.backgroundColor=[UIColor clearColor];
[mview addSubview:name];
[name release];

[window addSubview:mview];
[mview release];
}

9:43 AM

UIbutton !! complete details

Posted by pradeep T

Hi everyone !! this is a new thread  I am starting ...... its a blog which contains iphone coding !! I have created this as a reference for myself in my development work and also help people who are new to iphone !! 



UIButton *myButton= [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
myButton.frame = CGRectMake(105,180, 115, 35);
[myButton setTitle:@"Apply Image" forState:UIControlStateNormal];
myButton.backgroundColor = [UIColor clearColor];
[myButton addTarget:self action:@selector(ApplyImage: ) forControlEvents:UIControlEventTouchUpInside];