play youtube video in iphone or ipad

Hi,There may be requirement to play youtube video in iphone or ipad using xcode or objective c language
This functionality is very simple
Checkout the following code (This will only work in device not in simulator)
- (void)embedYouTube:(NSString*)url frame:(CGRect)frame
{
    NSString* embedHTML = @"<html><head> <style type=\"text/css\">body {background-color: transparent;color: white;}</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" width=\"%0.0f\" height=\"%0.0f\"></embed></body></html>";
    NSString* html = [NSString stringWithFormat:embedHTML, url, frame.size.width, frame.size.height];
    
    UIWebView *webView =[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    [webView loadHTMLString:html baseURL:nil];
    [self.view addSubview:webView];
}
- (void)viewDidLoad
{
    [self embedYouTube:@"http://www.youtube.com/watch?v=lzsBwnv_dAg&feature=player_embedded" frame:CGRectMake(0, 0, 320, 480)];
    [super viewDidLoad];
}

Find current location in iphone or ipad app

Hi, There is usually requirement to find the current location in google map.
Specially many iphone app or ipad app provide the current location of the user in the application
Here is the steps to find the current location in the MKMapView
1. add the CoreLocation.Framework
2. then  #import <CoreLocation/CLLocationManagerDelegate.h> 
3. set the delegate CLLocationManagerDelegate
4. write the following code in your iphone or ipad app


CLLocationManager   *locmanager;
BOOL    wasFound;



- (void)viewDidLoad
{
    [super viewDidLoad];
    
    locmanager = [[CLLocationManager alloc] init]; 
[locmanager setDelegate:self]; 
[locmanager setDesiredAccuracy:kCLLocationAccuracyBest];
[locmanager startUpdatingLocation];    
}

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation 
    if (wasFound) return
wasFound = YES;
    
CLLocationCoordinate2D loc = [newLocation coordinate];
    NSLog(@"current longitude = %f  ,   current latitude = %f",loc.longitude,loc.latitude);
}



Add button and Textfield programmatically

Hi,
Here is the code how to add the Button or UIButton and TextField or UITextField programmatically


 UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(30, 30, 50, 25)];
 [textField setBorderStyle:UITextBorderStyleLine];
 [self.view addSubview:textField];

  UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  [button setFrame:CGRectMake(30, 65, 85, 37)];
  [button setTitle:@"Click me" forState:UIControlStateNormal];
  [self.view addSubview:button];

play sound programmatically in iphone

Here is the code to play the sound programmatically in iphone
1. First include the AVFoundation.framework
2. second   #import <AVFoundation/AVFoundation.h>
3. Last paste the following code where you want to play the song

NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/song.mp3", [[NSBundle mainBundle] resourcePath]]];
    AVAudioPlayer *av = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil];
    [av play];
    [av setVolume:1.0];

fit text inside the webview

In Web view there are some text which does not fit into the screen
Here is the code make the text fir with in the webview
UIWebView *wv = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
    [wv loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://development-iphone-app.blogspot.com"]]];
    wv.scalesPageToFit = YES;  // This property will fit the content of the webview in the screen
    [self.view addSubview:wv];

load htmlstring in UIwebview

Here is the code for the load htmlstring in UIwebview
write the following code in your viewDidLoad method

UIWebView *wv = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
    [wv loadHTMLString:@"<html><body><a href='http://development-iphone-app.blogspot.com'>Click Me</a></body></html>" baseURL:nil];
    [self.view addSubview:wv];

set background picture in UITableview

Here is the code to set the background image in UITableview

self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.jpg"]];

ipad 2

The new invention by Apple is come again i.e. ipad 2
ipad 2 is the 33% thinner and 15% lighter.
Faster graphics,faster surfing with ipad 2.
ipad 2 cover is the best amongst the all the features.
ipad 2 cover attaches magnetically and aligns perfectly
Here is the image for the ipad 2.

imac

Here is the best computer I have ever seen i.e. imac.
imac is the best computer that i like most.
imac is developed by Apple Inc.
imac possess the very nice features wireless mouse that people like most and wireless keyboard
Here find the images for the imac


study using ipad

Now,your child will learn each and every thing easily
ipad the Apple Inc. product will help your child in learning.
Now, the learning process is not boring it is now easy and make your child happy.
Watch this video.

ipad

The great product develop by Apple Inc is the ipad
ipad is the great electronic device that I have ever had
playing game on ipad is the great adventure for me
Really ipad is the great electronic device developed by Apple Inc.
Thanks to Mr. Steve jobs.Here is the ipad photo how it looks

iphone 4

Apple Inc. products are the best products in the world that I have ever used
Apple is the worlds best company in the market to develop the electronic items
Here are the some best electronic products invented by Apple Inc. that I have using since last 2 years

1. iphone 4
  •  iphone 4 is the great smart phone that I have ever seen.
  • Great thing with the iphone 4 is the its Retina display make the look great. Here is the iphone 4


ipad

Hey,All here is the great invention of the Apple Inc.
its nothing but ipad.
ipad is the great thing that is invented by Apple Inc.
Believe me if any one use the ipad only single time he/she will forget all the things.
He or she will definitely buy the Apple great product that is nothing but ipad.
ipad comes in different memory configuration.
Here is the video for the god of electronic device i.e. ipad

Mac osx or macintosh video

Mac os x is the worlds most advance operating system developed by Apple Inc.
Here is the some demo for the how Mac osx look and how Mac osx works
By watching this macintosh video you will be the big fan of macintosh or Mac osx

Mac osx

Mac os is the world's most advanced operation system here is the Video for the
Mac os which is developed by Apple Inc.

Mac

Mac OS X is the world’s most advanced operating system developed by Apple Inc.
Mac os is the unix based graphical user interface operating system
in Mac os we can develop the iphone app and ipad app using xcode the very powerful development tool for iphone app development.
In xcode you can develop the various kinds of app
1. View based iphone app
2. Navigation iphone app
3. open gl
4.split view based applications
and many more..

xcode 4

Now, xcode 4 is available for the iphone application development
xcode 4 integrate the  interface builder and many more things.
There is no requirement of separate interface builder.
Automatically sets the IBOutlet and make them release.
Automatically implements the action methods.
Here is the screenshot for xcode 4



iphone app for map view

iphone app for map view
Here is the iphone app for map view
please write the following code in iphone app where you to open the map application in iphone app or ipad app

[[UIApplication sharedApplicationopenURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%@,%@"SLT,SLO,DLT,DLO]]];

Application for iphone for uitableview

Application for iphone UITableview example
There are mainly 3 metods to write

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 0;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
return cell;
}

Download code here

iphone icon badge value

Here is the code to assign the badge value for the iphone icon
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:9];
write this code where you want to assign the badge value

iphone 5

Hi,
Iphone 5 is the new upcoming best mobile phone in the world
Features
1. very Thin and slim
2. Holographic display
3. Laser Keyboard

Here is the vedio

Powered by Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More