Popup custom view on current view

很多时候需要在原视图上弹出一个自定义视图让用户确认一些东西. 通常的做法一般使用UIAlertView/UIAlertController. 但是做为自定义它们的风格可能与app不符.


思路如下:

1) 创建一个UIViewController,背景是一个UIImageView,Autolayout至全屏,图片选用半透明的,目标是为了显示前一页的部分内容

2) 通过presentViewController:animated:completion:来弹出视图

3) 注意弹出的视图的背景颜色要改成clearColor,否则无法透明


    viewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

    if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)]){

        viewController.providesPresentationContextTransitionStyle = YES;

        viewController.definesPresentationContext = YES;

        [viewController setModalPresentationStyle:UIModalPresentationOverCurrentContext];

    }

    else{

        [self setModalPresentationStyle:UIModalPresentationCurrentContext];

        [self.navigationController setModalPresentationStyle:UIModalPresentationCurrentContext];

    }

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


参考图:


onReachBottom触底函数用这个但是无法保证搜索框和u-tabs标签页是吸顶的,该怎么解决?<template> <view class="deliveryOrder"> <u-toast ref="uToast"></u-toast> <view class="searchBtn"> <u-search placeholder="订单号" :showAction="true" v-model="orderValue" shape="round" actionText="查询" :animation="true" @search="searchClick()" @custom="searchClick()"></u-search> <text class="screening" @click="handleScreening">筛选</text> </view> <view class="tabsBox"> <u-sticky bgColor="#fff"> <u-tabs :list="list" :is-scroll="false" :current="current" bar-width="50" active-color="orange" @change="change"> </u-tabs> <view v-if="current===0"> <scroll-view @scrolltolower="lowerBottom" @refresherrefresh="getFresh" :refresher-enabled="true" :refresher-triggered="triggered" scroll-y="true" class="scrollHeight"> <view class="scrolllist" v-if="allList&&allList.length>0"> <view class="orderscrollItem" v-for="(item,index) in allList" :key="index" @click="toDetail(item)"> <view class="itemTitle"> {{item}} </view> </view> <view class="more_text" v-if="showMoreData"> 没有更多数据了... </view> </view> <view v-else class="empty_box"> <u-empty mode="order" icon="http://cdn.uviewui.com/uview/empty/car.png" > </u-empty> </view> </scroll-view> </view> <view v-if="current===1"> 待配送 </view> <view v-if="current===2"> 配送中 </view> <view v-if="current===3"> 待签收 </view> <view v-if="current===4"> 已完成 </view> </u-sticky> </view> <u-popup :show="showPopup" :round="10" mode="top" @close="showPopup=false"> <view class="popup"> <text class="popupTitle">筛选条件</text> <view class="formBox"> <u--form :model="form" ref="uForm" labelWidth="90px"> <u-form-item label="时间范围" prop="timeValue" borderBottom @click="showCalendar=true"> <u-input v-model="form.timeValue" :disabled="true" r
03-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值