- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
return nil;
}Set backgroundColor of the subclass of UIView to [UIColor clearColor]. You should set it in the designated initializer, because backgroundColor is set before drawRect: of UIView.
self.backgroundColor = [UIColor clearColor];The “problem” is that iOS is very finicky about not wasting memory
and since the modal view will completely cover the one beneath it,
it doesn’t make much sense to keep it loaded.
Therefore, iOS unloads the view that presents the modal one.
You may check this behavior by implementing -viewWillDisappear: and -viewDidDisappear:.
CGAffineTransform transform = CGAffineTransformMake(cos(a),sin(a),-sin(a),cos(a),x-x*cos(a)+y*sin(a),y-x*sin(a)-y*cos(a));Although both of the API support drawing in a Core Graphics context, CGContextShowTextAtPoint method may not support chinese language, while NSString's drawAtPoint: support more encodings like chinese.
- Converting a NSString to a cString for use with CGContextShowTextAtPoint
- iPad - Draw Rotated Text using drawRect method in iPad
If value of the a variable doesn't go right, do the following:
- try to make it as a property and overwrite its setter
NSLogits value in setter- Insert a breakpoint in the setter
- Run, everytime it stops at the breakpoint, watch the call stack of the main thread.
frame and center use parent coordinate system, while bounds use coodinate system relative to its own.
- Cocoa: What's the difference between the frame and the bounds?
- UIView frame, bounds and center
- Things wot I learnt from Stanford – iPad & iPhone App Development
- stanford cs193p Lecture 5 View Animation
#define WORD_EXTENSION @"doc docx "
#define PPT_EXTENSION @"ppt pptx "
#define EXCEL_EXTENSION @"xls xlsx "
#define DOC_EXTENSION WORD_EXTENSION PPT_EXTENSION EXCEL_EXTENSION
NSArray *extensions = [DOC_EXTENSION componentsSeparatedByString:@" "];
for (NSString *extension in extensions) {
NSLog(@"%@", extension);
}frame of UIView is relative to its parent UIView. If you need to update its frame, please copy it into a CGRect and assign it back to its frame. Don't try to modify it by view.frame.origin = CGPointZero; which won't work.
CGRect newFrame = view.frame;
newFrame.origin = CGPointZero;
view.frame = newFrame;remove ~/Library/Developer/Xcode/DerivedData and /var/folders.
After paused at breakpoint, in lldb, use the following command
po [self.window recursiveDescription]UIButton implements UIControl to handle target-actions. So the following snippet makes use of APIs of UIControl.
UIView *superView = self.window.rootViewController.view;
for (UIView *view in superView.subviews) {
if ([[view class] isSubclassOfClass:[UIButton class]]) {
// suppress warning using pointer casting
UIButton *btn = (UIButton *)view;
// logging out the targets of UIButton
NSSet *targets = [btn allTargets];
NSLog(@"targets of UIButton(%@)", btn);
for (id target in targets) {
NSLog(@"target %@", [target class]);
// logging out actions for specific target and UIControlEventTouchUpInside
NSArray *actions = [btn actionsForTarget:target forControlEvent:UIControlEventTouchUpInside];
for (NSString *action in actions) {
NSLog(@"action %@", action);
}
}
// logging out all control events
NSLog(@"%lu", (unsigned long)[btn allControlEvents]);
}
}