小编Nic*_*ick的帖子

PHP mkdir - 抛出错误“文件存在”

我目前通过工作存折的部分iOS6的由团队通过教程在raywenderlich.com,并且我得到我的PHP以下错误:

警告:mkdir() [function.mkdir]:文件存在于第 26 行的 /xxx/xxx/xxx/xxx/Pass.php

警告:mkdir() [function.mkdir]:文件存在于第 26 行的 /xxx/xxx/xxx/xxx/Pass.php

警告:rmdir(/tmp/50c8d11c60538/..) [function.rmdir]:第 54 行 /xxx/xxx/xxx/xxx/Pass.php 中的目录不为空

我班上的代码如下:

class Pass
{
    private $workFolder = null;
    private $ID = null;

    var $content = null;
    var $passBundleFile = null;

    private function copySourceFolderFilesToWorkFolder($path)
    {
        // recurse over the contents and copy files
        $files = new RecursiveIteratorIterator(
                        new RecursiveDirectoryIterator($path),
                        RecursiveIteratorIterator::SELF_FIRST);

        foreach ($files as $name => $fileObject)
        {
            if (is_file($name) && substr($fileObject->getFileName(), 0, 1) != ".")
            {
                copy($name, $this->workFolder."/".str_replace($path."/", "",$name));
            } …
Run Code Online (Sandbox Code Playgroud)

php mkdir rmdir

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

用键盘动画UIView

我需要在即将开始的项目中添加聊天功能.

与此同时,我一直在努力实现我所期望的简单问题,即在屏幕底部有一个UIView,里面有一个UITextView,当用户点击UITextView时,它会用键盘设置动画.

我有它工作,但不幸的是键盘的动画略微落后于它上面的视图.这是我到目前为止的实现:

注册键盘通知:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
Run Code Online (Sandbox Code Playgroud)

键盘通知方法:

- (void)keyboardWillShow:(NSNotification*)notification
{
    CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue];
    NSInteger curve = [notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue];

    [UIView animateWithDuration:duration delay:0 options:curve animations:^{

        CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
        _chatViewBottomConstraint.constant = keyboardFrame.size.height;
        [self.view layoutIfNeeded];

    } completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

有没有其他人做过类似的事情,能否为我提供更好的解决方案?

objective-c uikeyboard ios

5
推荐指数
2
解决办法
6217
查看次数

UITableView没有正确选择

我正在开发一个iPhone应用程序,我有一个UITableView,它通过URL填充XML feed.

比如说,填充了三个单元格.

如果我点击第一个单元格没有任何反应,但是如果我点击第二个或第三个单元格,它会将我带到与第一个单元格相关的第二个屏幕,而其他单元格也会发生同样的情况 - 点击它没有任何东西,点击另一个单元格它将我带到前一个选定的第二个屏幕.

我从来没有遇到过这种情况而且很困惑.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];

    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle 
                              reuseIdentifier:@"UITableViewCell"];
    }

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    LocationsItem *atm = [[locations atms] objectAtIndex:[indexPath row]];
    [[cell textLabel] setText:[atm atmName]];

    float distance = [[atm atmDistance] floatValue];
    NSString *distanceString = [NSString stringWithFormat:@"%0.2f miles from current location", distance];
    [[cell detailTextLabel] setText:distanceString];

    return cell;
}

- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    LocationsItem *atm = [[locations …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview

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

iOS故事板 - 导航控制器不工作

我在使用Storyboard的iOS项目中遇到导航控制器问题.

该项目的主要部分是UITabBar.当应用程序第一次加载时,会显示以下屏幕RegisterViewController:

注册视图控制器

当用户点击"注册"按钮时,会发出HTTP POST请求,然后在收到响应(JSON对象)后,屏幕上会显示QuestionnaireViewController:

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

QuestionnaireViewController *questionnaireViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"QuestionnaireView"];
[questionnaireViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[questionnaireViewController setQuestionsAndAnswers:_questionsAndAnswers];

[self presentViewController:questionnaireViewController animated:NO completion:nil];
Run Code Online (Sandbox Code Playgroud)

问卷查看控制器

当用户点击QuestionnaireViewController中的单元格时,会向prepareForSegue发送一条消息:sender:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    UINavigationController *navigationController = segue.destinationViewController;

    AnswersViewController *answersViewController = [[navigationController viewControllers] objectAtIndex:0];

    NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];
    NSArray *answers = [[_questionsAndAnswers objectAtIndex:indexPath.row] objectForKey:@"answers"];

    [answersViewController setAnswers:answers];
}
Run Code Online (Sandbox Code Playgroud)

此时应用程序崩溃时出现以下错误: - [AnswersViewController viewControllers]:发送到实例的无法识别的选择器.

以下是我的故事板的更全面的概述,这可能有助于理解我出错的地方:

故事板

我很难过如何解决这个问题,我希望那里有人能够提供帮助.

谢谢,尼克

storyboard uitableview uiviewcontroller uinavigationcontroller ios

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