Graphics Reference
In-Depth Information
otherButtonTitles : nil ] show ];
}
else
{
[[[ UIAlertView alloc ] initWithTitle : @"Inside White Layer"
message : nil
delegate : nil
cancelButtonTitle : @"OK"
otherButtonTitles : nil ] show ];
}
}
}
@end
Figure 3.10 The touched layer is correctly identified.
The -hitTest: method also accepts a CGPoint ; but instead of a BOOL , it returns either
the layer itself or the deepest sublayer containing the point. This means that you do not
need to transform and test the point against each sublayer in turn manually, as you do when
using the -containsPoint: method. If the point lies outside of the outermost layer's
bounds, it returns nil . Listing 3.5 shows the code for determining the touched layer by
using the -hitTest: method.
Search WWH ::




Custom Search