Showing posts with label Iphone SDK. Show all posts
Showing posts with label Iphone SDK. Show all posts

Sunday, 2 September 2012

How to Make iPhone Apps With No Programming Experience


The iPhone has taken the mobile industry by storm, and has positioned itself as the cool new most-needed gadget. Part of what makes the iPhone so popular is the abundance of apps that are available to iPhone users. There are literally lots of apps, and new ones keep coming day by day, letting iPhone users play games, check weather, edit photos, create music, and much more: all without ever lifting their gaze from the glow of the iPhone screen.
So start your new dream App without any Programming knowledge.Lets go into the book!..





Tuesday, 19 June 2012

Check to see if I have an Internet connection on the iPhone using the Cocoa Touch libraries





- (void) checkNetworkStatus:(NSNotification *)notice
{
// called after network status changes

NetworkStatus internetStatus = [internetReachable currentReachabilityStatus];
switch (internetStatus)

{
case NotReachable:
{
NSLog(@"The internet is down.");
self.internetActive = NO;

break;

}
case ReachableViaWiFi:
{
NSLog(@"The internet is working via WIFI.");
self.internetActive = YES;

break;

}
case ReachableViaWWAN:
{
NSLog(@"The internet is working via WWAN.");
self.internetActive = YES;

break;

}
}

NetworkStatus hostStatus = [hostReachable currentReachabilityStatus];
switch (hostStatus)

{
case NotReachable:
{
NSLog(@"A gateway to the host server is down.");
self.hostActive = NO;

break;

}
case ReachableViaWiFi:
{
NSLog(@"A gateway to the host server is working via WIFI.");
self.hostActive = YES;

break;

}
case ReachableViaWWAN:
{
NSLog(@"A gateway to the host server is working via WWAN.");
self.hostActive = YES;

break;

}
}
}--------------
///Import at the beginning of your implementation file
#import "Reachability.h"

//// Where you need it
Reachability *r = [Reachability reachabilityWithHostName:@"www.google.com"];
NetworkStatus internetStatus = [r currentReachabilityStatus];

if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)){
/// Create an alert if connection doesn't work
UIAlertView *myAlert = [[UIAlertView alloc]
initWithTitle:@"No Internet Connection" message:@"You require an internet connection via WiFi or cellular network for location finding to work."
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[myAlert show];
[myAlert release];
} else{
/// Whatever you want
}


//Class.h
#import "Reachability.h"
#import

- (BOOL)connected ;

//Class.m
- (BOOL)connected
{
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [reachability currentReachabilityStatus];
return !(networkStatus == NotReachable);
}
Then, we can use this whenever we want to see if there is a network
if(![self connected])
{
// not connected
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No network connection"
message:@"You must be connected to the internet to open the website."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
} else
{
// connected, do some internet stuff

}


Thursday, 14 June 2012

Sample Project on Objective C---BODY MASS INDEX(BMI)

Application overview in Iphone.


Get the complete application code and documentation at
http://www.iosbricks.blogspot.in/

Saturday, 19 May 2012

App Level Notification for Iphone SDK

AppLevelNotification:




AppDelegate.h:----
#import

@class Animations2ViewController;

@interface Animations2AppDelegate : NSObject {
UIWindow *window;
Animations2ViewController *viewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet Animations2ViewController *viewController;
-(void)appdelegateNotificationRecieved;
@end
AppDelegate.m:----
#import "Animations2AppDelegate.h"
#import "Animations2ViewController.h"

@implementation Animations2AppDelegate

@synthesize window;
@synthesize viewController;


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[[NSNotificationCenter defaultCenter]addObserver:viewController selector:@selector(notificationRecieved) name:@"maheshWokeUp" object:nil];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(appdelegateNotificationRecieved) name:@"maheshWokeUp" object:nil];
// Override point for customization after app launch
[window addSubview:viewController.view];
[window makeKeyAndVisible];

return YES;
}
-(void)appdelegateNotificationRecieved{

NSLog(@"Appdelegate notificationr received");
}

- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}


@end


Animations2ViewController.h:----

#import

@interface Animations2ViewController : UIViewController {

IBOutlet UIImageView *imgView;
IBOutlet UIButton *btn1;
IBOutlet UIButton *btn2;
}
-(IBAction)startAnimating;
-(IBAction)stopAnimating;
-(void)notificationRecieved;
@end


Animations2ViewController.m:----

#import "Animations2ViewController.h"

@implementation Animations2ViewController

-(void)notificationRecieved{

NSLog(@"notification recieved");
}

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration{

NSLog(@"device moved");
}

-(IBAction)startAnimating{

[imgView startAnimating];
}
-(IBAction)stopAnimating{

[[NSNotificationCenter defaultCenter]postNotificationName:@"maheshWokeUp" object:nil];

}


- (void)viewDidLoad {
[super viewDidLoad];


UIImage *img1= [UIImage imageNamed:@"1.jpg"];
UIImage *img2= [UIImage imageNamed:@"2-1.jpg"];
UIImage *img3= [UIImage imageNamed:@"2.jpg"];
UIImage *img4= [UIImage imageNamed:@"3.jpg"];

NSArray *arrImages =[[NSArray alloc]initWithObjects:img1,img2,img3,img4,nil];
imgView.animationImages =arrImages;
imgView.animationDuration =10;
}

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
}


- (void)dealloc {
[super dealloc];
}

@end