Monday, December 20, 2010

Wednesday, September 15, 2010

Displaying the text of the UITableViewCell

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

// create a cell

UITableViewCell *cell=[[UITableViewCell alloc]
initWithStyle:UITableViewCellDefault
reuseIdentifer:@"sunny"];


//fill with contet


cell.textLabel.text=[test objectAtIndex:indexPath.row];


//return it

return cell;

// we done it baby =))

}

How many rows in the section

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return test.count;
}

How To Read a File From Your Application Bundle

 -(void)viewDidLoad
{

NSString *myfile = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pList"]; 
test=[[NSArray alloc]initWithContenstOfFile:myfile];

[Super viewDidLoad];

}

http://iphoneincubator.com/blog/tag/nsbundle
for help :)

How to get current date objective c

NSLog ( @”The current date and time is: %@”, [NSDate date] );

How to add items in NSArray

NSArray *aboutItems =  [NSArray arrayWithObjects:@"ItemOne",@"ItemTwo",@"ItemThree",nil];
Do not forget to add nil at the end

Monday, September 13, 2010

How to convert NSData into image

UIImage *img = [[UIImage alloc] initWithData:data];

Alert view


  
 -(void)view DidLoad
{
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Really reset?" message:@"Do you really want to reset this game?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] autorelease];
    // optional - add more buttons:
    [alert addButtonWithTitle:@"Yes"];
    [alert show];
[alert release];

}

Make a keyboard away!

use resingfirstResponder method to any text filed to make a key board away from screen :)
nd also make connect a delegate to file owner nd use a doc nd find a bool textfiled should return method dat make a keyborad aways when return key hit =))

Using autorelease pool

when yew are not shore abt to release ur obj use auto release pool dat take some tym too release it in a while :)

Thursday, September 9, 2010

How much memory can an iPhone app use?

It depends on the device you’re using. For iPhone 3G if total memory goes over 10-14MB you will receive memory warnings and some times app crashes. When it hits 20MB, it will crash for sure.

Play Sound in iPhone Code

http://howtomakeiphoneapps.com/2009/08/how-to-play-a-short-sound-in-iphone-code/


kitna easy hain na ? =))

Set Background Image for UIView

In iPhone SDK, there is no setBackgroundImage function for setting an background image of an UIView. But actually, this can be done by the setBackgroundColor function. The following code will set the background view to Red.
1self.view.backgroundColor = [UIColor redColor];
So if you want to set a picture as an background image of a view, just initialize anUIColorinstance with an image and set it to the view.
1UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"anImage.png"]];
2self.view.backgroundColor = background;
3[background release];
Please note that you have to set all the items which are in front of the background view to clearColor such that they will not cover the background image.
hogya yupieeeeeeeeeeee =))

Apple to Publish App Store Guidelines, Relax Rules


http://www.bloomberg.com/news/2010-09-09/apple-to-publish-app-store-guidelines-relax-restrictions.html

How to Animate with a UIView

[UIView beginAnimations:nil context:NULL];

// yaha apni  logic likh bacha =))

[UIview setAnimationDurattion:1:0];
[UIview setAnimationRepeatCount:10];
[UIview setAnimationRepeatAutoreverses];

CGpoint pos=myObject.center;
pos.y=200.0f;
pos.x-150.0f;
myobject=pos;



[UIView commitaAnimations];

What’s Different About Coding for iPhone?

If you have never used Cocoa or its predecessor NextSTEP, you may find Cocoa Touch, the
application framework you’ll be using to write iPhone applications, a little alien; there are
some fundamental differences from other common application frameworks such as those
used when building .NET or Java applications. Don’t worry too much if you feel a little lost at
first. Just keep plugging away at the exercises, and it’ll all start to fall into place after a while.
If you have written programs using Cocoa or NextSTEP, you’re going to find a lot in the
iPhone SDK that is familiar to you. A great many classes are unchanged from the versions
that are used to develop for Mac OS X, and even those that are different tend to follow the
same basic principles and use design patterns similar to the ones you are already familiar
with. There are, however, several differences between Cocoa and Cocoa Touch.
Regardless of your background, you need to keep in mind some key differences between
iPhone development and desktop application development.



1-Only One Running Application
2-Only One Window
3-Limited Access
4-Limited Response Time
5-Limited Screen Size
6-Limited System Resources
7-No Garbage Collection