小编Mic*_*lum的帖子

键盘出现时移动UIView

对不起我的英语.

我试图在行动之前找到它.但问题是ViewController在景观和创造的UIView一半ViewController.在UIViewUITextView.但现在当键盘在键盘ViewController下方向下滚动时出现背景.只看到UIView.如果触摸空间,键盘将消失,背景将恢复.我想只是移动UIView键盘出现时.

非常感谢你.

iphone objective-c ios

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

使用CGAffineTransform的奇怪结果

我试图使用几个CGAffineTransformsCGAffineTransformConcats.将动画串起来.我试图实现的总体目标是让我的图像旋转45度,同时向上移动50像素,然后再向下旋转45度.

 CGAffineTransform translateUp = CGAffineTransformMakeTranslation(0, -50);
    CGAffineTransform firstSpin = CGAffineTransformMakeRotation(M_PI_4);
    CGAffineTransform translateDown = CGAffineTransformMakeTranslation(0, 50);
    CGAffineTransform secondSpin = CGAffineTransformMakeRotation(M_PI_4);
    CGAffineTransform transform1 =  CGAffineTransformConcat(translateUp, firstSpin);
    CGAffineTransform transform2 =  CGAffineTransformConcat(translateDown, secondSpin);
    CGAffineTransform transformFull =  CGAffineTransformConcat(transform1, transform2);    
    [UIView beginAnimations:@"MoveAndRotate" context:nil];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
    [UIView setAnimationDuration:0.5];
    mainCharacterImage.transform = transformFull;
    [UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)

现在请注意,我对CG相关的所有内容都很陌生,但我不明白为什么这不起作用.

但是我不认为这不是一个事实,这不是一个奇怪的部分,我的问题主要是,任何人都可以解释为什么上面的代码导致我的图像不仅向上移动和旋转,而是移动右边大约100个像素?

任何建议都非常感谢!

cocoa-touch objective-c cgaffinetransform uiviewanimation ios

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

如何从iOS中的内容获取url图像.帮我?

我有一个如何从URL获取图像的问题.

我试过了:

NSURL *url=[NSURL URLWithString:[NSString stringwithFormat:@"http://kenh14.vn/c102/20120715022212850/ngoc-trinh-la-model-thi-khong-nen-ngai-the-hien.chn"]];
NSURLRequest *request=[NSURLRequest requestWithURL:url];
NSURLConnection *connection=[[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:NO];
[connection start];

NSData *data=[NSURLConnection sendSynchrounousRequest:request returningResoibse:nil error:nil];
Run Code Online (Sandbox Code Playgroud)

我想用这个图像UIImageView.

objective-c nsurl uiimageview ios

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

将应用程序从背景重新启动到前台

您正在开发一个iPhone应用程序.当我点击UITextView中的链接时,链接在safari中打开,我的应用程序变为后台.关闭野生动物园后,我点击了我的应用程序图标,它又被带到了前台.我的问题是,当我关闭Safari时,我们是否可以自动将应用程序恢复到前台,而无需单击应用程序图标.

iphone cocoa-touch objective-c uitextview

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

如何在iphone中自动发送邮件?

我使用以下内容来显示mailViewController

-(IBAction)sendMailbuttonTapped {

if([MFMailComposeViewController canSendMail]) {
    MFMailComposeViewController *mailCont = [[MFMailComposeViewController alloc] init];
    mailCont.mailComposeDelegate = self;

    [mailCont setSubject:@"yo!"];
    [mailCont setToRecipients:[NSArray arrayWithObject:@"surendherbtech@gmail.com"]];
    [mailCont setMessageBody:@"Don't ever want to give you up" isHTML:NO];

    [self presentModalViewController:mailCont animated:YES];
    [mailCont release];
}


}


- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
    [self dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)

它显示良好但我现在需要的是,我希望在他点击按钮时不用用户的知识发送邮件.它必须在没有用户点击发送选项的情

任何人都可以告诉我如何自动发送邮件提前谢谢

iphone xcode objective-c mfmailcomposeviewcontroller

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

UIScreen主屏幕bounds.size.height总是1024

[UIScreen mainScreen].bounds.size.height无论iPad应用程序采用何种布局模式,为什么总是返回1024?

我试图有一个基于布局模式动态生成的自定义视图,我总是得到1024的高度?

+ (CGRect)rectForView {
NSLog(@"The height is %f", [UIScreen mainScreen].bounds.size.height );
return CGRectMake( 0.0f, 0.0f, [[UIScreen mainScreen]bounds].size.width, (([UIScreen mainScreen].bounds.size.height ) - 100));
}
Run Code Online (Sandbox Code Playgroud)

objective-c ios uiscreen cgrectmake

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

具有一个goto标签的C代码无法按预期工作

我被要求打破一个C程序,这个程序最初只是一个主要的方法,有很多评论很好的段.如果发生错误,每个段都使用相同的定义函数字符串'die'.die函数使用goto标签'out'来关闭程序.

在将这些段中的每一个转换为函数之后,这些函数现在都是从底部的按比例缩小的main方法调用的,每个段的这个转出代码不再有效.'out'标签位于main中,XCode编译器告诉我goto标签尚未定义.

所以我想我问我如何以最有效的方式在每个本地函数中定义我的out标签?

以下是一些代码片段,所有代码片段都显示在它们的顺序/结构中:

模具定义

    #define die(msg, ...) do {                      \
(void) fprintf (stderr, msg, ## __VA_ARGS__); \
(void) fprintf (stderr, "\n");                \
goto out;                                     \
} while (0)
Run Code Online (Sandbox Code Playgroud)

使用die的函数示例

void createContext(void){
        context = clCreateContext (0, 1, &device_id, NULL, NULL, &err);
        if (!context || err != CL_SUCCESS)
            die ("Error: Failed to create a compute context!");
    }
Run Code Online (Sandbox Code Playgroud)

最后我的主要内容,其中包含最后的模具

main (int argc, char *argv[])
{

    (Several functions called here)

out:
    /* Shutdown and cleanup.  */
    if (data)
        free (data);

    if (results)
        free …
Run Code Online (Sandbox Code Playgroud)

c program-entry-point goto function

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

检查存储在mysql中的md5(密码)匹配值

我无法理解为什么这不起作用.在注册时我有(在PHP中)

$data['salt'] = randomStr(3);
$data['password'] = md5($data['salt'].md5($data['password']));
Run Code Online (Sandbox Code Playgroud)

然后我有一个IOS应用程序将MD5加密的pw($ xpassword)传递给Web应用程序.所以我想如果我使用:

$q1_result = mysql_query("SELECT password, salt FROM `members` WHERE `username`='". $username. "'");
$row = mysql_fetch_array($q1_result);
echo "this should match? = " .md5($xpassword.($row['salt']));
Run Code Online (Sandbox Code Playgroud)

echo'd值应与存储在数据库中的值匹配为password

...但它没有任何帮助将非常感激

php md5

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

如何从集合结束而不是从头开始在Objective-C中实现for-in循环?

我试图通过for循环迭代NSDictionary.但我希望它从这个集合的结尾开始迭代到它的开始.我该如何实现这种回归?

objective-c for-in-loop ios

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

Xcode分析说"物体的潜在泄漏"

我是初学者,在Xcode上运行'Analyze'之后我发现了这个警告:

IphoneFeatureImageDetailViewController *img = [[IphoneFeatureImageDetailViewController alloc] initWithNibName:@"IphoneFeatureImageDetailViewController" bundle:nil];    
img.imagesArray = [heroArray copy];
img.index = imgButton.tag; // AT THIS LINE IT SAYS POTENTIAL MEMORY LEAK
[self.navigationController pushViewController:img animated:YES];
[img release];
Run Code Online (Sandbox Code Playgroud)

请指出我正确的方向!

iphone ios

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