English 中文(简体)
• 触及人口以外的任何地点,以掩盖概览
原标题:touch any place outside popup menu(self draw) to hide the uiview
  • 时间:2010-12-10 05:06:09
  •  标签:
  • iphone

I have created myself popup menu(draw an uiview and list some items). But I hope when touch any place outside the uiview, the popup menu will disappear.

我试图使用

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{

    //UITouch* touch = [touches anyObject];


}


- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{ 
}

要赶上感触活动,但认为有时不会启动上述职能。

欢迎任何意见

增 编

联合国

最佳回答

What do you implement in the touchesCanceled:withEvent: ? Sometimes the touch flow will be touchesBegan -> (touchesMoved) -> touchesCanceled, no touchesEnded happaned.

问题回答

过去,我已经这样做,建立了“国际律师联合会”意见书,随后推翻了“国际律师联合会”类的分点方法。 这是每当发出问答通知时都会发射的。 当发生这种情况时,你可以发现,这段话题是否在你的意见范围内或之外。

例如,您的《国际律师联合会》认为:

<>Custom TouchUIView.h

#import 

@protocol CustomTouchUIViewDelegate

- (void) uiViewTouched:(BOOL)wasInside;

@end

@interface CustomTouchUIView : UIView 

// Properties
@property (nonatomic, assign) id delegate;

@end

<>Custom TouchUIView.m

#import "TOTouchUIView.h"

@implementation CustomTouchUIView

#pragma mark - Synthesize
@synthesize delegate;

#pragma mark - Touches
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
    if( point.x > 0 && point.x < self.frame.size.width && point.y > 0 && point.y < self.frame.size.height )
    {
        [delegate uiViewTouched:YES ];
        return YES;
    }

    [delegate uiViewTouched:NO ];
    return NO;
}
@end

我有一个可下载的例子:





相关问题
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风格的解决办法,只是一个简单的袖珍流程......

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

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

热门标签