小编dar*_*man的帖子

无法使用PHPMailer发送包含正确字符的电子邮件

我正在尝试使用PHPmailer类发送电子邮件,但我发送的html是空的,或者字符是未配置的,没有重音符号.

<?php
header("Content-Type: text/html; charset=ISO-8859-1", true);
require_once('class.phpmailer.php');
include "config.php";

$nome = trim($_POST['nome']);
$email  = trim($_POST['Imail']);
$usuario = trim($_POST['usuario']);
$senha = trim($_POST['senha']);
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP

try {
  $mail->AddAddress($email, $nome);
  $mail->SetFrom('editora@conectfarma.net', 'Conectfarma');
  $mail->AddReplyTo('editora@conectfarma.net', 'Conectarma');
  $subject = 'Guia Rápido de Interações Medicamentosas';
  $sendsubject= "=?utf-8?b?".base64_encode($subject)."?=";
  $mail->Subject = $sendsubject;
 $mensagem  = "<!DOCTYPE html>
<html>
<body>
Bem vindo ao Guia Rápido …
Run Code Online (Sandbox Code Playgroud)

html php email phpmailer

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

UIGestureRecognizer拖动UIView

我正在尝试建立一个从右到左GestureRecognizer拖动UIView.如果用户将视图拖动到屏幕的一半,则视图将自动拖动到左上角以丢弃它,但如果用户不拖动到屏幕的一半,它将返回到屏幕右侧的角落.这里很少丢失,任何教程或什么?谢谢

编辑:下面是一些代码,它是一个UIImageView,在一个内部UIScrollView,我需要拖动整个滚动或只是其中的图像:

_myScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.window.bounds.size.width, self.window.bounds.size.height)]; [_myScroll setContentSize:CGSizeMake(self.window.bounds.size.width , 1300)];

_tutorial = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.window.bounds.size.width, 1300)]; [_tutorial setImage:[UIImage imageNamed:@"Default"]];
_tutorial.contentMode = UIViewContentModeScaleAspectFit; [_myScroll addSubview:_tutorial];

_tutorial.userInteractionEnabled = YES;
    UIPanGestureRecognizer * recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:_tutorial action:@selector(handlePan:)]; 
 [_tutorial addGestureRecognizer:recognizer];

    [self.window addSubview:_myScroll];
Run Code Online (Sandbox Code Playgroud)

而我尝试拖动的方法 UIImageView

- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer {

    CGPoint translation = [recognizer translationInView:_myScroll];
    recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
                                         recognizer.view.center.y + translation.y);
    [recognizer setTranslation:CGPointMake(0, 0) inView:_myScroll];

}
Run Code Online (Sandbox Code Playgroud)

uiview uigesturerecognizer ios

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

IOS 7 UITextField resignFirstResponder BAD

我在使用UItextField时遇到了崩溃,在我的customCell中,当我resignFirstResponder文本字段时,但它不再可见(表格视图滚出窗口).我仍然可以找到文本字段,指针继续可访问,它不为空,崩溃只发生在IOS7上,在IOS6上我没有这个问题.下面是一些代码:

textField是一个全局变量.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString * CellIdentifier = [NSString stringWithFormat:@"Cell%d",indexPath.row];

    TableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[TableCell alloc] init];

        if(indexPath.row == 0)
        {
            [textField setFrame:CGRectMake(15, 5, cell.frame.size.width-60, cell.frame.size.height)];
            textField.textAlignment = NSTextAlignmentLeft;
            [textField setBorderStyle:UITextBorderStyleNone];
            textField.textColor = [UIColor blackColor];
            textField.tag = indexPath.row;
            textField.delegate = self;
            textField.secureTextEntry = YES;
            [textField setFont:[UIFont fontWithName:@"Arial-BoldMT" size:15]];
            textField.textColor = [UIColor whiteColor];
            textField.returnKeyType = UIReturnKeyDone;
            [textField setAdjustsFontSizeToFitWidth:YES];
            textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
            textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Senha" …
Run Code Online (Sandbox Code Playgroud)

objective-c uitextfield ios resignfirstresponder ios7

9
推荐指数
1
解决办法
4457
查看次数

像雷达目标C的动画

我怎么能像雷达那样做UIView动画?我已经有了一个UIView,用drawrect创建了圆圈,但我怎么能创建一条线,做一个时钟动画?

如下图所示: 在此输入图像描述

objective-c clock uiview uianimation ios

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

禁用tabBar上的用户交互

我正在应用程序后显示图像didFinishLaunchingWithOptions,应用程序包含在标签栏中,在第一个视图中我有一些按钮.用户只能在按下第一张图像中的按钮后才能继续使用该应用程序,问题是,某些用户可以与标签栏进行交互,并且第一个视图中的按钮甚至包含图像.如何完全禁用这些按钮和tabBar中的用户交互,然后仅在按下按钮并且图像消失时启用?

tabbar uibutton uiview uiimageview ios

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

创建自定义tableview分隔符时出错

我正在尝试使用自定义分隔符创建一个tableview.我制作了一个包含内容的自定义Cell,另一个只包含带分隔符的UIImageView.问题在于如何访问内容.我不能使用indexPath.row

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier: @"CustomCell"];
    if(cell == nil) 
    { 
        cell = [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] objectAtIndex:0];
    }

    SeparatorCell *cellSeparator = (SeparatorCell *) [tableView dequeueReusableCellWithIdentifier: @"SeparatorCell"];
    if(cellSeparator == nil) 
    { 
        cellSeparator = [[[NSBundle mainBundle] loadNibNamed:@"SeparatorCell" owner:self options:nil] objectAtIndex:0];
    }

    if(indexPath.row % 2)
    {
        UIFont * myCustomFont = [UIFont fontWithName:@"Arial Black" size:16];
        [cell.titulo setFont:myCustomFont];
        cell.titulo.textColor = [UIColor colorWithRed:103/255.0f green:169/255.0f blue:0/255.0f alpha:1];

        cell.titulo.text = [Title objectAtIndex:myRow];
        cell.subtitle.text = [Subtitle objectAtIndex:myRow];

        cell.tag …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview custom-cell

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

获取目标C中两个NSString之间的时差

我有两个来自服务器的字符串,用于存储时间,我需要比较这两个字符串之间的时间间隔(以分钟为单位,必要时以小时为单位)。我应该转换NSDate还是使用NSString

NSString看看这样的:

NOW 14:22
LAST TIME 10:18
Run Code Online (Sandbox Code Playgroud)

编辑#1由于每个人都在说我要使用NSDate,所以我将数据库中的数据转换为DATETIME,现在我可以使用以下代码比较两个NSDate了:

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"pt_BR"]];
    [dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];

    NSDate *currentDateTimeWithOffset = [NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone localTimeZone] secondsFromGMT]];

    NSString *strDate = [dateFormatter stringFromDate:currentDateTimeWithOffset];
    NSDate * now = [dateFormatter dateFromString:strDate];
NSDate *date = [dateFormatter dateFromString:@"2013-04-09 12:10:18"];

NSLog(@"Difference %f",[now timeIntervalSinceDate:date]);
Run Code Online (Sandbox Code Playgroud)

结果如下:

 Difference 864.000000
 NOW 2013-04-09 15:24:42 +0000
 LAST DATE 2013-04-09 12:10:18
Run Code Online (Sandbox Code Playgroud)

那是对的吗?差异以秒为单位?

objective-c nsdate nsstring ios

0
推荐指数
1
解决办法
3073
查看次数