开发者

iPhone - "Watermaking" a view on the screen without interfering with touches

I have some views on wich I'd like to draw some text, with or without transparency, and I'd like this displayed text not to interfere with user touches.

I mean for example, let's say I have a view with a list view and some buttons. I'd like to display on top of the whole thing some text (and some graphics) that does not move, with the list, and that does not catch the touches that开发者_如何学编程 the user can make on this text/graphics and let them pass through for exemple to scroll the list view.

How may I do this ?


The simplest way is this, for every UI component:

[view setUserinteractionEnabled:NO];

This will disable gestures and touches on that component, while leaving the possibility of interacting on everything below/beneath.

So, you can create your "watermark" view, disable interactions, add as a subview to your current view and you'll be fine.


You can probably use a CATextLayer as layers don't catch touches. The other graphics can be CALayers too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜