English 中文(简体)
属于电话屏幕顶端的文字
原标题:Words falling from the top of screen in iphone

Im一字。 在这里,我想说几句话从听说的顶部。

屏幕底部有一条红色线。

用户必须在达到红色线之前选择正确的措辞。

So how can i implement the falling effect in iphone.(i.e words falling effect).

任何人都能够帮助我。

提前感谢。

最佳回答

您可以采用《国际律师联合会意见书》来实施。 这一样本代码都属于一个观点控制器,加上一个标签,fallingLabel。 你们可以将其扩大到包括多个标签。

The key point is to import the QuartzCore framework. This gives you access to the presentationLayer of a view, which holds the current state of an animating view. You add the framework to your project in the project summary part of Xcode, then put the following in the top of your view controller s implementation file:

#import <QuartzCore/QuartzCore.h>

下面的代码表示标签的下降。 由于<代码>,速度将加快。 UIView AnimationOptionCurveEase 在的设定中,使你具有令人信服的重力效应。

self.fallingLabel.center = CGPointMake(160,50);

[UIView animateWithDuration:3
                      delay:0 
                    options:UIViewAnimationOptionCurveEaseIn 
                 animations:^{self.fallingLabel.center = CGPointMake(160,400);}
                 completion:nil];

现在,你需要实施接触处理。 标签上没有这样做,因为内部认为它已经处于屏幕的底层。 您处理您认为的控制器的触角:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint touchLocation = [touch locationInView:self.view];
    if ([self.fallingLabel.layer.presentationLayer hitTest:touchLocation])
    {
        NSLog(@"Label was touched");
        CALayer *presLayer = self.fallingLabel.layer.presentationLayer;
        [UIView animateWithDuration:0 
                              delay:0 
                            options:UIViewAnimationOptionBeginFromCurrentState 
                         animations:^{self.fallingLabel.frame = presLayer.frame;} 
                         completion:nil];
    }
}

Here, what is happening is that the presentation layer is being queried to see if the touch falls within it s current bounds. If so, we then start a new animation, which starts from the current state - in this case all I have done is stop the falling of the label, but you could implement anything you like here.

如果您的标签有多种下降,那么,在你发现已触及的标签之前,你就可以在每一版本层上尝试<>打字<<>>>。

问题回答

a. 尝试使用通常的动画片区,但运行时间不一:

NSOperationQueue *_queue;
_queue = [[NSOperationQueue alloc] init];
SEL selector = @selector(fallWord);
NSMethodSignature *signature = [self methodSignatureForSelector:selector];
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:signature];
[inv setTarget:self];
[inv setSelector:selector];
NSInvocationOperation *fall= [[[NSInvocationOperation alloc] initWithInvocation:inv] autorelease];    
[_queue addOperation:fall];

之后,执行下降 语言方法,在什么地方,你将确定一个下降的教义:

UILabel *lb = [[UILabel alloc] initWithFrame:CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)];
    [UIView animateWithDuration:1 
                          delay:0 
                        options:UIViewAnimationOptionCurveLinear 
                     animations:^{
                         [lb setCenter:CGPointMake(<#CGFloat x#>, <#CGFloat y#>)];
                     } completion:nil];

then, you will need to implement touches and in method

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSUInteger touchCount = 0;
    for (UITouch *touch in touches) {
        [self dispatchFirstTouchAtPoint:[touch locationInView:self] forEvent:nil];
        touchCount++;  
    }   
}

检查贵格检查组内是否有线索

Coco2d加上箱子或芯片,将帮助你实现减小影响(将重力推到屏幕底)。

我将与Cocos2d /chipmunk共同制定总体计划。

Learn both. Cocos2d - CCLabelTTF, CCLayer, CCSprite, CCTouch recognition, how to schedule a timer with cocos2d

Chipmunk - bodies, gravity, using the timer set up with cocos2d to step through the physics, calling a C static void function to update the CCLabelTTF s that are still on screen, removing those objects that aren t on screen (past the red line), and how to use the Cocos2d touch methods to verify if you hit a word or not. ie method

-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

Coco2d的矿址有大量开端文件,而没有如此大量的木片文件,但你可以找到hoo的辅导。

我不敢肯定,如果能够打断“国际调查”的估算,那么它们将需要怎样做。

在执行过程中,你还需要确保你认为案文比案文大。

如果你走宇宙2d+物理发动机路线以实现你的目标,你将很好地学习如何使游戏更加复杂。

You are actually looking for AutoComplete textbox. Basically there is no such thing exist in iPhone. but with the help of UIPicker view you can provide such effect





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签