小编US-*_*234的帖子

材料组件 - 文本字段 - IOS

我是快速编程的新手,我需要设计具有浮动占位符输入的登录页面.我已经使用POD安装了MDCTextInput.

增加了进口

import MaterialComponents.MaterialTextFields
Run Code Online (Sandbox Code Playgroud)

并在viewDidLoad()下面添加了代码,

companyID.placeholder = "Company ID"
companyID.placeholderLabel.highlightedTextColor = UIColor.white
companyID.placeholderLabel.textColor = UIColor.white
companyID.underline?.color = UIColor.white
companyID.delegate = self
Run Code Online (Sandbox Code Playgroud)

我已按照IOS中的材料组件中给出的步骤进行操作

我不清楚这条线,

To achieve the animations and presentations defined by the guidelines (floating placeholders, character counts), a controller that conforms to protocol MDCTextInputController must be initialized to manage the text field.
Run Code Online (Sandbox Code Playgroud)

我没有得到浮动占位符动画,如何在swift4中执行此操作?请有人给我一个想法.

Material iOS Github链接是: material-components-ios

ios material-design swift3

6
推荐指数
2
解决办法
8673
查看次数

当app处于后台(最小化)时,推送通知无效 - iOS

我是Swift的新手,我正在创建聊天应用程序,我需要在app处于前台或最小化时发送通知.

但是当应用程序最小化时,我没有收到通知(它在连接USB时有效.

  1. 启用远程通知

  2. Xcode设置中的背景提取

  3. 启用推送通知

  4. 生产APns证书

通知代码:

class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    let gcmMessageIDKey = "gcm.message_id"

    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        FirebaseApp.configure()

        Messaging.messaging().delegate = self
        Messaging.messaging().shouldEstablishDirectChannel = true

        if #available(iOS 10.0, *) {

            UNUserNotificationCenter.current().delegate = self

            let authOptions: UNAuthorizationOptions = [.alert, .sound, .badge]
            UNUserNotificationCenter.current().requestAuthorization(
                options: authOptions,
                completionHandler: {_, _ in })
        } else {
            let settings: UIUserNotificationSettings =
                UIUserNotificationSettings(types: [.alert, .sound, .badge], categories: nil)
            application.registerUserNotificationSettings(settings)
        }

        application.registerForRemoteNotifications()

        NotificationCenter.default.addObserver(self, selector: #selector(tokenRefreshNotification(_:)), name: …
Run Code Online (Sandbox Code Playgroud)

push-notification apple-push-notifications firebase swift4 ios11.3

6
推荐指数
1
解决办法
1378
查看次数

在YII Framework中提交按钮后保持当前页面

我正在尝试提交表单,在表单子目录后,当前页面应保持用户输入的数据.怎么实现这个?

public function actionUpload()
    {

       $model=new UploadModel();
       $basemodel=new BaseContactList();
       $importmodel=new ImportedFilesModel(); 


        $importmodel->name =$basemodel->name;  
        $importmodel->import_date = $now->format('Y-m-d H:i:s');
        $importmodel->server_path = $temp;
        $importmodel->file_name = $name;
        $importmodel->crm_base_contact_id = $crm_base_contact_id;

        if ($importmodel->save())
            echo "Import saved";
        else 
            echo "Import Not Saved";
        unset($_POST['BaseContactList']);    
        $this->redirect(Yii::app()->request->urlReferrer);

    }
Run Code Online (Sandbox Code Playgroud)

此行"$this->redirect(Yii::app()->request->urlReferrer);"转到上一页,但用户输入的值将被清除.如何在不清除表单中的值的情况下重定向到上一页?

php yii

5
推荐指数
1
解决办法
6946
查看次数

如何自动播放嵌入谷歌驱动器视频?

我已将视频上传到谷歌驱动器并尝试使用我网站中的链接。视频应该自动播放。我在网址后尝试过?autoplay=1?start=1 。但视频不会自动播放。

请任何人给我提出一个想法。

html php embed

5
推荐指数
0
解决办法
6596
查看次数

从PHPMailer异常获取完整的错误消息

我正在使用PHPMailer类发送smtp邮件,但是我需要从mysql表中的PHPmailerException跟踪日志,

代码:

 $mail = new PHPMailer(true);
    try {
    $mail->Host =$dmmodel->host;
    $mail->Username= $dmmodel->username;
    $mail->Password= $dmmodel->password;
    $mail->Mailer='smtp';
    $mail->Port=$dmmodel->port;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = ($dmmodel->smtp_enableSSL==1?'ssl':($dmmodel->smtp_enableSSL==2 ? 'tls':''));
    $mail->SMTPDebug = 2;
    $mail->From = $dmmodel->email_from;
    $mail->FromName = $dmmodel->name_from;
    $mail->Subject    = $this->getContentBody($docmodel->content_subject,$docmodel->crm_base_contact_id,$_POST["taskid"],$postcode,$recall_by,$recall_dt,true);
    $mail->AddAddress($email[$i]);
    $mail->IsHTML(true); 
}
   catch (phpmailerException $e)
    {
         $msg = "Email Delivery failed -" .  $e->errorMessage();
         echo "Email not sent";
    } 
Run Code Online (Sandbox Code Playgroud)

其中$ msg变量只有消息“ SMTP错误:无法验证”, 但是当我发出alert时,我收到了此问题的完整消息(如下所示),

SMTP->来自服务器:220 smtp.gmail.com ESMTP n3sm27565307paf.13-gsmtp
SMTP->来自服务器:250-smtp.gmail.com,为您服务,[122.164.189.101] 250-SIZE 35882577 250-8BITMIME 250-AUTH登录平原XOAUTH2平原用户令牌厦伯250增强状态代码250管道250堵塞250 SMTPUTF8
SMTP->错误:服务器未接受密码:535-5.7.8用户名和密码未接受。要了解更多信息,请访问535 5.7.8 https://support.google.com/mail/?p=BadCredentials n3sm27565307paf.13-gsmtp
SMTP->从服务器:250 2.1.5刷新n3sm27565307paf.13-gsmtp
未发送电子邮件

如何将以上消息存储在变量中?请谁能帮我得到这个完整的消息

php phpmailer

1
推荐指数
2
解决办法
1万
查看次数