После интеграции пользовательской таблицы, как взять представление lable из этой созданной таблицы? - PullRequest
0 голосов
/ 27 января 2012

Я пытаюсь оживить UITableView и сталкиваюсь с трудностями. Я загрузил таблицу, используя пользовательские ячейки, и мне нужно снова получить элементы этой таблицы и переместить содержимое этой строки вниз в анимации.

Пока я выполняю это, я могу получить только всю таблицу из UIView. На самом деле я хочу получить пользовательское содержимое ячейки таблицы из таблицы и выполнить анимацию для этого.

Я борюсь с:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{   
    UILabel *temp=[[UILabel alloc]init];
    temp.text=nil;

    UIView *anim = nil;
    id currentObject;
    for (UIView *theview in destination.superview.subviews) 
    {

        if ([theview isKindOfClass:[UITableView class]]) 
        {
            NSLog(@"%@",theview);
            UIView *vi= theview;//(UITableView *)[UITableView class];
            NSLog(@"%@",vi);
            for(UIView *vi1 in vi.superview.subviews )
            {
                if ([vi1 isKindOfClass:[UITableViewCell class]])
                {
                    NSLog(@"%@",vi1);
                }

            anim = theview;
            break;
        }
    }
}

Как мне получить данные от этого?

1 Ответ

0 голосов
/ 05 сентября 2012

Теперь я просто создал пользовательский UILable и присвоил ему текст моей ячейки, а затем анимировал его .... вот код ...

в методе таблицы viewDidSelect, который я кодировал это ....

NSArray *visibleCells = [tableView visibleCells];

    NSLog(@"the count %d",[visibleCells count]);
    //UITableViewCell *aCell=[tableView cellForRowAtIndexPath:indexPath];
    UITableViewCell *visiblecell=[tableView cellForRowAtIndexPath:indexPath];
    NSLog(@"the count %@",aCell);
    NSLog(@"The visible cell ::%@",visiblecell);
    int i=0;
    for (UITableViewCell *theCell in visibleCells)
    {
        if ([theCell isEqual:visiblecell])
        {
            selectedView.frame =CGRectMake( 0,i*(480/[visibleCells count]),320,50);
            break;
        }
        i++;
    }


    anim=selectedView;

    if (!anim)
        return;
    [self pathGenerate:anim];

и у меня есть отдельная функция анимации, просто я назвал это ...

- (void)pathGenerate:(UIView *)anim
{

    // [self.tabBarController.tabBar insertSubview:(UIImageView*)[UIImage imageNamed:@"Coffee_smoke.png"] atIndex:0];
    self.tabBarItem.image=nil;

    UIBezierPath *movePath = [UIBezierPath bezierPath];
    [movePath moveToPoint:anim.center];//-->down---->destinationPoint.center
    [movePath addQuadCurveToPoint:CGPointMake(170, 420) 
                     controlPoint:CGPointMake(200,10)];/* // 2nd phase //destinationPoint.center.x+200, destinationPoint.center.y-100)];*/

    CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    moveAnim.path = movePath.CGPath;
    moveAnim.removedOnCompletion = YES;

    CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform"];
    scaleAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
    scaleAnim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)];
    scaleAnim.removedOnCompletion = YES;

    CABasicAnimation *opacityAnim = [CABasicAnimation animationWithKeyPath:@"alpha"];
    opacityAnim.fromValue = [NSNumber numberWithFloat:1.0];
    opacityAnim.toValue = [NSNumber numberWithFloat:0.1];
    opacityAnim.removedOnCompletion = YES;

    CAAnimationGroup *animGroup = [CAAnimationGroup animation];
    animGroup.animations = [NSArray arrayWithObjects:moveAnim, scaleAnim, opacityAnim, nil];
    animGroup.duration = 0.5;
    [anim.layer addAnimation:animGroup forKey:nil];


    // self.tabBarItem.image=[UIImage imageNamed:@"Coffee_smoke.png"];



}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...