Php 如何进入iPhone登录页面
我想知道如何启动iPhone登录页面。我尝试过使用SQL/PHP并将其连接到XCode,但没有成功。我想现在最好的办法是什么 垛式支架关闭:Php 如何进入iPhone登录页面,php,iphone,sql,login,Php,Iphone,Sql,Login,我想知道如何启动iPhone登录页面。我尝试过使用SQL/PHP并将其连接到XCode,但没有成功。我想现在最好的办法是什么 垛式支架关闭: //LoginExampleViewController.h #进口 @类逻辑控制器; @接口登录名AppDelegate:NSObject{ UIWindow*窗口; 登录名:viewController*viewController; } @属性(非原子,保留)IBUIWindow*window; @属性(非原子,保留)IBOutlet loginVi
//LoginExampleViewController.h
#进口
@类逻辑控制器;
@接口登录名AppDelegate:NSObject{
UIWindow*窗口;
登录名:viewController*viewController;
}
@属性(非原子,保留)IBUIWindow*window;
@属性(非原子,保留)IBOutlet loginViewController*viewController;
@结束
//loginViewController.h
#进口
@接口登录名ViewController:UIViewController{
IBOutlet UITextField*未定义字段;
IBOutlet UITextField*密码字段;
iButton*登录按钮;
NSMutableData*接收数据;
}
@属性(非原子,保留)UITextField*未定义字段;
@属性(非原子,保留)UITextField*passwordField;
@属性(非原子,保留)UIButton*loginButton;
@属性(非原子,保留)NSM可变数据*接收数据;
-(iAction)多洛金:(id)发送方;
@结束
//loginViewController.m
#导入“loginViewController.h”
@视图控制器的实现
@合成未修饰字段;
@合成密码域;
@综合登录按钮;
@综合接收数据;
//实现viewDidLoad以在加载视图(通常从nib)后执行附加设置。
-(无效)viewDidLoad{
[超级视图下载];
}
//实现iAction方法
-(iAction)多洛金:(id)发送方
{
NSString*uname=unameField.text;
NSString*password=passwordField.text;
NSURL*URL=[NSURL URLWithString:[NSString stringWithFormat:@]http://localhost:8888/powerplay/insert2.php?name=%@&password=%@,“uname,password]];//在这里放置URL链接
NSURLRequest*req=[NSURLRequest requestWithURL:theURL];
NSURLConnection*connection=[NSURLConnection connectionWithRequest:req委托:self];
如果(连接){
NSLog(@“连接成功”);
}
否则{
NSLog(@“失败”);
}
}
//实现连接委托
-(void)连接:(NSURLConnection*)连接didReceiveData:(NSData*)数据{
}
-(void)连接:(NSURLConnection*)连接DidReceiverResponse:(NSURResponse*)响应{
[接收数据集长度:0];
//NSURL*theURL=[响应URL];
}
-(无效)连接IDFinishLoading:(NSURLConnection*)连接{
NSLog(@“成功”,接收数据长度);
[连接释放];
[接收数据发布];
}
//实现TextField委托
-(BOOL)textField应返回:(UITextField*)textField{
[textField resignFirstResponder];
返回YES;
}
//实现TouchEvent
-(无效)触摸开始:(NSSet*)触摸事件:(UIEvent*)事件
{
[超级触摸开始:触摸事件:事件];
}
-(无效)未收到记忆警告{
//如果视图没有superview,则释放该视图。
[超级记忆警告];
//释放所有未使用的缓存数据、图像等。
}
-(无效)视图卸载{
[超级视频下载];
//释放主视图的所有保留子视图。
//例如,self.myOutlet=nil;
}
-(无效)解除锁定{
[现场释放];
[密码字段释放];
[super dealoc];
}
@结束
为我工作,如果您有问题,请留言。谢谢您,我会试试这个!
// LoginExampleViewController.h
#import <UIKit/UIKit.h>
@class LoginExampleViewController;
@interface LoginExampleAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
LoginExampleViewController *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet LoginExampleViewController *viewController;
@end
// LoginExampleViewController.h
#import <UIKit/UIKit.h>
@interface LoginExampleViewController : UIViewController {
IBOutlet UITextField *unameField;
IBOutlet UITextField *passwordField;
IBOutlet UIButton *loginButton;
NSMutableData *receiveData;
}
@property (nonatomic, retain) UITextField *unameField;
@property (nonatomic, retain) UITextField *passwordField;
@property (nonatomic, retain) UIButton *loginButton;
@property (nonatomic, retain) NSMutableData *receiveData;
-(IBAction)doLogin: (id)sender;
@end
// LoginExampleViewController.m
#import "LoginExampleViewController.h"
@implementation LoginExampleViewController
@synthesize unameField;
@synthesize passwordField;
@synthesize loginButton;
@synthesize receiveData;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
//Implement IBAction method
-(IBAction) doLogin: (id) sender
{
NSString *uname= unameField.text;
NSString *password= passwordField.text;
NSURL *theURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8888/powerplay/insert2.php?name=%@&password=%@",uname, password]]; //Here you place your URL Link
NSURLRequest *req = [NSURLRequest requestWithURL:theURL];
NSURLConnection *connection = [NSURLConnection connectionWithRequest:req delegate:self];
if (connection) {
NSLog(@"connection successful");
}
else {
NSLog(@"Failed");
}
}
// Implement Connection delegate
-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
}
-(void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
[receiveData setLength:0];
// NSURL *theURL=[response URL];
}
-(void) connectionDidFinishLoading:(NSURLConnection *)connection{
NSLog(@"success",[receiveData length]);
[connection release];
[receiveData release];
}
// Implement TextField delegate
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
// Implement TouchEvent
-(void)touchesBegan :(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
}
- (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 {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[unameField release];
[passwordField release];
[super dealloc];
}
@end