images/loading.gif' data-original="http://images2015.cnblogs.com/blog/868060/201603/868060-20160325185248667-1082487349.gif" />
这是从美团弄得
你点了地区以后 , 就可以查看经纬度 ,因为笔者懒, 有现成的文本框 , 所有偷懒了。
下面是一些枯燥的代码了 。
#import <UIKit/UIKit.h>#import "RootTableViewController.h"@interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window;@end
#import "AppDelegate.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window.rootViewController=[[UINavigationController alloc] initWithRootViewController:[[RootTableViewController alloc] initWithStyle:UITableViewStyleGrouped]]; return YES;}
#import <UIKit/UIKit.h>#import "SecondViewController.h"@interface RootTableViewController : UITableViewController<NS
#import "RootTableViewController.h"@interface RootTableViewController ()@end@implementation RootTableViewController- (void)viewDidLoad { [super viewDidLoad]; self.title=@"城市列表"; self.arrname=[NSMutableArray array]; NSURL *url=[NSURL URLWithString:@"http://www.meituan.com/api/v1/divisions?mtt=1.help%2Fapi.0.0.im7coqq1"]; NSData *data=[NSData dataWithContentsOfURL:url]; NS
#import "ViewController.h"#import "RootTableViewController.h"@interface SecondViewController : ViewController@property(strong,nonatomic)UILabel *lblname;@property(strong,nonatomic)UILabel *lblpwd;@property(strong,nonatomic)UITextField *name;@property(strong,nonatomic)UITextField *pwd;@property(strong,nonatomic)UIButton *buton;@property(strong,nonatomic)NSString *strweidu;@property(strong,nonatomic)NSString *strjindu;@end
#import "SecondViewController.h"@interface SecondViewController ()@end@implementation SecondViewController- (void)viewDidLoad { [super viewDidLoad]; UIImageView *image=[[UIImageView alloc]initWithFrame:self.view.frame ]; [image setImage:[UIImage imageNamed:@"15EADA084F41FF349CED23058FD34D0E"]]; [self.view addSubview:image]; self.lblname=[[UILabel alloc]initWithFrame:CGRectMake(50, 200, 100, 50)]; self.lblname.text=@"精度"; [self.view addSubview:self.lblname]; self.lblpwd=[[UILabel alloc]initWithFrame:CGRectMake(50, 330, 100, 50)]; self.lblpwd.text=@"维度"; [self.view addSubview:self.lblpwd]; self.name=[[UITextField alloc] initWithFrame:CGRectMake(150, 200, 200, 50)]; [self.view addSubview:self.name]; self.name.text =self.strweidu; self.name.borderStyle=UITextBorderStyleRoundedRect; self.pwd=[[UITextField alloc] initWithFrame:CGRectMake(150, 330, 200, 50)]; [self.view addSubview:self.pwd]; self.pwd.text=self.strjindu; self.pwd.borderStyle=UITextBorderStyleRoundedRect; self.buton=[[UIButton alloc] initWithFrame:CGRectMake(120, 400, 174, 66)]; self.buton.backgroundColor=[UIColor colorWithRed:0.532 green:1.000 blue:0.161 alpha:1.000]; self.buton.layer.cornerRadius=10; [self.buton setTitle:@"确认" forState:0]; [self.buton setTitleColor:[UIColor whiteColor] forState:0]; [self.buton addTarget:self action:@selector(next) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:self.buton];}-(void)next{ RootTableViewController *root=[[RootTableViewController alloc]init]; [self presentViewController:root animated:YES completion:nil];}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}/*#pragma mark - Navigation// In a storyboard-based application, you will often want to do a little preparation before navigation- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller.}*/@end
原标题:xml文件解析(解析以后在RootTableViewController输出)
关键词:xml