添加模糊的背景图像

时间:2016-11-30 07:41:56

标签: ios background-image

是否有另一种方法可以在不使用imageview并拍摄上一个窗口的快照的情况下为弹出窗口添加模糊背景。

4 个答案:

答案 0 :(得分:1)

非常简单。

你所需要的只是一个带有模糊和活力的视觉效果视图"视图。 您可以直接从对象库中添加它。只需拖放视图即可。您可以根据需要设置背景颜色以进行清除,并且可以将模糊级别设置为浅色,超轻等等....只需浏览这些内容

答案 1 :(得分:1)

要添加模糊视图,您可以使用UIBlurEffect。您可以选择3-4种模糊样式。您还可以在0.0到1.0的范围内更改此模糊效果的Alpha,以实现更准确的图像模糊

添加模糊效果 - 你可以像view.addBlurEffect一样使用

     function ipn($ipn_data) {

    define('SSL_P_URL', 'https://www.paypal.com/cgi-bin/webscr');
    define('SSL_SAND_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
    $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    if (!preg_match('/paypal\.com$/', $hostname)) {
        $ipn_status = 'Validation post isn\'t from PayPal';
        if ($ipn_data == true) {
            //You can send email as well
        }
        return false;
    }

    // parse the paypal URL
    $paypal_url = ($_REQUEST['test_ipn'] == 1) ? SSL_SAND_URL : SSL_P_URL;
    $url_parsed = parse_url($paypal_url);

    $post_string = '';
    foreach ($_REQUEST as $field => $value) {
        $post_string .= $field . '=' . urlencode(stripslashes($value)) . '&';
    }
    $post_string.="cmd=_notify-validate"; // append ipn command
    // get the correct paypal url to post request to
    $paypal_mode_status = $ipn_data; //get_option('im_sabdbox_mode');
    if ($paypal_mode_status == true)
        $fp = fsockopen('ssl://www.sandbox.paypal.com', "443", $err_num, $err_str, 60);
    else
        $fp = fsockopen('ssl://www.sandbox.paypal.com', "443", $err_num, $err_str, 60);

    $ipn_response = '';

    if (!$fp) {
        // could not open the connection. If loggin is on, the error message
        // will be in the log.
        $ipn_status = "fsockopen error no. $err_num: $err_str";
        if ($ipn_data == true) {
            echo 'fsockopen fail';
        }
        return false;
    } else {
        // Post the data back to paypal
        fputs($fp, "POST $url_parsed[path] HTTP/1.1\r\n");
        fputs($fp, "Host: $url_parsed[host]\r\n");
        fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
        fputs($fp, "Content-length: " . strlen($post_string) . "\r\n");
        fputs($fp, "Connection: close\r\n\r\n");
        fputs($fp, $post_string . "\r\n\r\n");

        // loop through the response from the server and append to variable
        while (!feof($fp)) {
            $ipn_response .= fgets($fp, 1024);
        }
        fclose($fp); // close connection
    }
    // Invalid IPN transaction. Check the $ipn_status and log for details.
    if (!preg_match("/VERIFIED/s", $ipn_response)) {
        $ipn_status = 'IPN Validation Failed';

        if ($ipn_data == true) {
            echo 'Validation fail';
            print_r($_REQUEST);
        }
        return false;
    } else {
        $ipn_status = "IPN VERIFIED";
        if ($ipn_data == true) {
            echo 'SUCCESS';
            print_r($_REQUEST);
        }
        return true;
    }
}

function ipn_response() {
    //mail("sobhagya1411@gmail.com","My subject",print_r($request,true));
    $ipn_data = true;
    if ($this->ipn($_REQUEST)) {
        $this->insert_data($_REQUEST);
    }
}

function issetCheck($post, $key) {
    if (isset($post[$key])) {
        $return = $post[$key];
    } else {
        $return = '';
    }
    return $return;
}


 public function insert_data(){

     $post = $_REQUEST;    

    $item_name= $this->issetCheck($post, 'item_name');         
    $amount = $this->issetCheck($post, 'mc_gross');
    $currency = $this->issetCheck($post, 'mc_currency');
    $payer_email = $this->issetCheck($post, 'payer_email');
    $first_name = $this->issetCheck($post, 'first_name');
    $last_name = $this->issetCheck($post, 'last_name');
    $country = $this->issetCheck($post, 'residence_country');
    $txn_id = $this->issetCheck($post, 'txn_id');
    $txn_type = $this->issetCheck($post, 'txn_type');
    $payment_status = $this->issetCheck($post, 'payment_status');
    $payment_type = $this->issetCheck($post, 'payment_type');
    $payer_id = $this->issetCheck($post, 'payer_id');
    $create_date = date('Y-m-d H:i:s');
    $payment_date = date('Y-m-d H:i:s');

    $paypal_sql = "INSERT INTO ipn_data_tbl (item_name,payer_email,first_name,last_name,amount,currency,country,txn_id,txn_type,payer_id,payment_status,payment_type,create_date,payment_date)
    VALUES ($item_name,'$payer_email','$first_name','$last_name','$amount','$currency','$country','$txn_id','$txn_type','$payer_id','$payment_status','$payment_type','$create_date','$payment_date')";
    mysql_query($paypal_sql); 

}

删除模糊您可以使用 - 从UIView view.removeBlurView

中删除模糊
~ f.input :content, label: false

答案 2 :(得分:0)

是的,请查看UIVisualEffectView和朋友。

答案 3 :(得分:0)

您可以使用UIVisualEffectView,如下所示

var blurView:UIVisualEffectView = UIVisualEffectView (effect: blur)
blurView.frame = view.bounds
blurView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
popUpView.addSubview(blurView)
相关问题