I'm trying to make an app for iphone which will send a tcp connection to a specified urf (or web application). I want the button to firstly give an allert before sending. I wrote this code for this:
-(IBAction)tiklandi:(id)sender{
NSString *buton1 = [sender titleForState:UIControlStateNormal];
NSString *uyariText = [[NSString alloc] initWithFormat:@"istek gönderiliyor!"];
UIAlertView *alert= [[UIAlertView alloc]initWithTitle:@"Sunucuya Gönderildi" message:uyariText delegate:nil
cancelButtonTitle:@"işlemi iptal ettiniz!"
otherButtonTitles: nil];
[alert show];
//[alert release];
but I couldn't use any url methods in my code.
My second question is, I can't see my Interface builder in Developer directory and also in project navigator of Xcode I can't see folders, all the classes come mixed between each other. I use Xcode 4.2, and I'm new with all these, can anyone please help?
I tried the listed solutions but I dont know how to interact my view controller files and .xib file. Here is my view controller .h file:
@interface ViewController : UIViewController
@property (nonatomic, retain) NSURLRequest *url;
@property (nonatomic,retain) UIButton *buton;
-(IBAction)fonksiyon:(id)sender;
@end
and this is my implementation file (of view control .. .m)
#import "ViewController.h"
@implementation ViewController
@synthesize buton;
@synthesize url;
-(IBAction)fonksiyon:(id)sender{
NSString *buton= [sender titleForState:UIControlStateNormal];
NSURL *url= [sender url];
NSString *uyariText= [[NSString alloc] initWithFormat:@"gönderiliyor!"];
UIAlertView *alertView= [[UIAlertView alloc]initWithTitle:@"Sunucuya Gönderildi"
message:uyariText
delegate:self
cancelButtonTitle:@"işlemi iptal ettiniz!"
otherButtonTitles:@"Server'a Git!", nil];
- (NSURL)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex != [alertView cancelButtonIndex]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://192.168.69.290/cgi-bin/ipad.pl";nil]];
}
}
}
The problem is that I can not make a relation between .xib file and the other ones via File's Owner. As I understand, when I drag from file's owner I should see my function (here called fonksiyon) too. Can anyone help?