滴滴

作者: b6e7b0be2603 | 来源:发表于2018-11-23 08:49 被阅读0次

    AppDelegate.m

    #import "AppDelegate.h"

    #import "ViewController.h"

    #import //头文件

    @interface AppDelegate ()

    //a5fc3eddf66f8727a7f47a9ca7ee0d34

    @end

    @implementation AppDelegate

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

        ViewController *vie=[[ViewController alloc] init];

        UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:vie];

        self.window.rootViewController=nav;

        [[AMapServices sharedServices] setEnableHTTPS:YES];

        [AMapServices sharedServices].apiKey = @"a5fc3eddf66f8727a7f47a9ca7ee0d34";

        return YES;

    }

    viewController.m

    #import "ViewController.h"

    #import

    #import

    #import "QRcodeViewController.h"

    #import "ZBarSDK.h"

    #define HCWidth self.view.frame.size.width

    #define HCHeigth self.view.frame.size.height

    #define hcheight [UIScreen mainScreen].bounds.size.height

    @interface ViewController ()<UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ZBarReaderDelegate>//协议

    {

        UIView*leftvie;//全局

        UIView*zhuvie;//全局

        UIButton*btn;//全局

        UITableView *tab;//全局

        UIImageView *img;//全局

        UIScrollView *vie;//全局

        NSArray*arr;//全局

    }

    @end

    @implementation ViewController

    - (void)viewDidLoad {

        [super viewDidLoad];

        //主标题

        self.navigationItem.title=@"个人热点:一个连接";

        //左按钮

    //    self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"13"] style:UIBarButtonItemStylePlain target:self action:nil];

        //右按钮

        self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"信息 (1)"] style:UIBarButtonItemStylePlain target:self action:nil];

        //右按钮

        self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"功能-扫一扫"] style:UIBarButtonItemStylePlain target:self action:@selector(tiao)];

        //    1.    点击左边按钮实现抽屉效果(

        //    2.    实现抽屉中的头像位置(

        //    3.    抽屉中的表格实现 ,并且输入图二的内容(

        //抽屉

        UIView *vie=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];

        btn=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];

        [btn setImage:[UIImage imageNamed:@"13"] forState:UIControlStateNormal];

        btn.layer.masksToBounds=YES;

        btn.layer.cornerRadius=20;

        [vieaddSubview:btn];

        [btn addTarget:self action:@selector(abc) forControlEvents:UIControlEventTouchUpInside];

        self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:vie];

        //文本

        leftvie=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, hcheight)];

        leftvie.backgroundColor=[UIColor whiteColor];

        [self.view addSubview:leftvie];

        //图片

        img=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 300,hcheight )];

        img.image=[UIImage imageNamed:@"999"];

        [leftvie addSubview:img];

        img.backgroundColor = [UIColor redColor];

        zhuvie=[[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, hcheight)];

        zhuvie.backgroundColor=[UIColor cyanColor];

        [self.view addSubview:zhuvie];

        zhuvie.backgroundColor = [UIColor redColor];

        // Do any additional setup after loading the view, typically from a nib.

        ///地图需要v4.5.0及以上版本才必须要打开此选项(v4.5.0以下版本,需要手动配置info.plist)

        [AMapServices sharedServices].enableHTTPS = YES;

        ///初始化地图

        MAMapView *_mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];

        ///把地图添加至view

        [zhuvieaddSubview:_mapView];

        ///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码

        _mapView.showsUserLocation = YES;

        _mapView.userTrackingMode = MAUserTrackingModeFollow;

        vie=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, 60)];

        vie.backgroundColor=[UIColor whiteColor];

        //添加图片

        for(inti = 0; i < 7; i++) {

            arr=@[@"单车",@"豪华车",@"快车",@"礼橙专车",@"出租车",@"等车",@"等车"];

            UILabel *tex=[[UILabel alloc] initWithFrame:CGRectMake(20+80*i, 0, 80, 60)];

            tex.textColor=[UIColor redColor];

            //设置文字交互

            //        tex.userInteractionEnabled = YES;

            tex.text=arr[i];

            [vieaddSubview:tex];

        }

        [zhuvie addSubview:vie];

        UIView * uiv = [[UIView alloc]initWithFrame:CGRectMake(0, 550, self.view.frame.size.width, 200)];

        UIImageView * imag = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];

        imag.image = [UIImage imageNamed:@"2"];

        [uivaddSubview:imag];

        [self.view addSubview:uiv];

    }

    -(void)abc{

        if(btn.selected==NO) {

            [UIView animateWithDuration:0.5 animations:^{

                zhuvie.transform=CGAffineTransformMakeTranslation(300, 0);

                self.navigationController.navigationBar.transform=CGAffineTransformMakeTranslation(300, 0);

            }];

            btn.selected=YES;

        }else{

            [UIView animateWithDuration:0.5 animations:^{

                zhuvie.transform=CGAffineTransformIdentity;

                self.navigationController.navigationBar.transform=CGAffineTransformIdentity;

            }];

            btn.selected=NO;

        }

    }

    -(void)tiao{

        //    1.    实现扫一扫,跳转到新的界面实现扫一扫

        ZBarReaderViewController * reader = [ZBarReaderViewController new];//初始化相机控制器

        reader.readerDelegate=self;

        reader.supportedOrientationsMask = ZBarOrientationMaskAll;//基本适配

        reader.showsHelpOnFail = YES;

        reader.scanCrop=CGRectMake(0, 0, 1, 1);

        ZBarImageScanner* scanner = reader.scanner;

        [scannersetSymbology:25config:0to:0];

        [self presentViewController:reader animated:YES completion:nil];

    }

    @end

    "MapTypeViewController.m"

    #import "MapTypeViewController.h"

    #import

    #import

    @interface MapTypeViewController ()

    @end

    @implementationMapTypeViewController

    - (void)viewDidLoad {

        [super viewDidLoad];

        // Do any additional setup after loading the view, typically from a nib.

        ///地图需要v4.5.0及以上版本才必须要打开此选项(v4.5.0以下版本,需要手动配置info.plist)

        [AMapServices sharedServices].enableHTTPS = YES;

        ///初始化地图

        MAMapView *_mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];

        ///把地图添加至view

        [self.viewaddSubview:_mapView];

        MAUserLocationRepresentation *r = [[MAUserLocationRepresentation alloc] init];

        r.showsAccuracyRing = NO;///精度圈是否显示,默认YES

        r.showsHeadingIndicator = NO;///是否显示方向指示(MAUserTrackingModeFollowWithHeading模式开启)。默认为YES

        r.fillColor = [UIColor redColor];///精度圈 填充颜色, 默认 kAccuracyCircleDefaultColor

        r.strokeColor = [UIColor blueColor];///精度圈 边线颜色, 默认 kAccuracyCircleDefaultColor

        r.lineWidth = 2;///精度圈 边线宽度,默认0

        r.enablePulseAnnimation = NO;///内部蓝色圆点是否使用律动效果, 默认YES

        r.locationDotBgColor = [UIColor greenColor];///定位点背景色,不设置默认白色

        r.locationDotFillColor = [UIColor grayColor];///定位点蓝色圆点颜色,不设置默认蓝色

        r.image = [UIImage imageNamed:@"你的图片"]; ///定位图标, 与蓝色原点互斥

        [_mapViewupdateUserLocationRepresentation:r];

    }

    相关文章

      网友评论

          本文标题:滴滴

          本文链接:https://www.haomeiwen.com/subject/mfnlqqtx.html