static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
This property provides a hint to the drawing system as to how it should treat the view. If set to YES, the drawing system treats the view as fully opaque, which allows the drawing system to optimize some drawing operations and improve performance. If set to NO, the drawing system composites the view normally with other content. The default value of this property is YES.
I’m sorry that I long ago coined the term 「objects」 for this topic because it gets many people to focus on the lesser idea. The big idea is 「messaging」 – that is what the kernal[sic] of Smalltalk is all about... The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be.
Alan Kay 曾屢次強調 Smalltalk 的核心不是面向對象,面向對象只是 the lesser ideas,消息傳遞纔是 the big idea。
$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/wangzz/Library/Developer/Xcode/DerivedData/YourApp-cqvijavqbptjyhbwewgpdmzbmwzk/Build/Products/Debug-iphonesimulator/YourApp.app/YourApp -o YourApp.dSYM
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:img style:UIBarButtonItemStylePlain target:self action:@selector(onBack:)]; self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
_myTableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);
navigationController.hidesBarsOnSwipe = Yes
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];
1 - (void)pan:(UIPanGestureRecognizer *)sender 2 { 3 typedef NS_ENUM(NSUInteger, UIPanGestureRecognizerDirection) { 4 UIPanGestureRecognizerDirectionUndefined, 5 UIPanGestureRecognizerDirectionUp, 6 UIPanGestureRecognizerDirectionDown, 7 UIPanGestureRecognizerDirectionLeft, 8 UIPanGestureRecognizerDirectionRight 9 }; 10 static UIPanGestureRecognizerDirection direction = UIPanGestureRecognizerDirectionUndefined; 11 switch (sender.state) { 12 case UIGestureRecognizerStateBegan: { 13 if (direction == UIPanGestureRecognizerDirectionUndefined) { 14 CGPoint velocity = [sender velocityInView:recognizer.view]; 15 BOOL isVerticalGesture = fabs(velocity.y) > fabs(velocity.x); 16 if (isVerticalGesture) { 17 if (velocity.y > 0) { 18 direction = UIPanGestureRecognizerDirectionDown; 19 } else { 20 direction = UIPanGestureRecognizerDirectionUp; 21 } 22 } 23 else { 24 if (velocity.x > 0) { 25 direction = UIPanGestureRecognizerDirectionRight; 26 } else { 27 direction = UIPanGestureRecognizerDirectionLeft; 28 } 29 } 30 } 31 break; 32 } 33 case UIGestureRecognizerStateChanged: { 34 switch (direction) { 35 case UIPanGestureRecognizerDirectionUp: { 36 [self handleUpwardsGesture:sender]; 37 break; 38 } 39 case UIPanGestureRecognizerDirectionDown: { 40 [self handleDownwardsGesture:sender]; 41 break; 42 } 43 case UIPanGestureRecognizerDirectionLeft: { 44 [self handleLeftGesture:sender]; 45 break; 46 } 47 case UIPanGestureRecognizerDirectionRight: { 48 [self handleRightGesture:sender]; 49 break; 50 } 51 default: { 52 break; 53 } 54 } 55 break; 56 } 57 case UIGestureRecognizerStateEnded: { 58 direction = UIPanGestureRecognizerDirectionUndefined; 59 break; 60 } 61 default: 62 break; 63 } 64 }
1 - (void) drawPlaceholderInRect:(CGRect)rect { 2 [[UIColor blueColor] setFill]; 3 [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment]; 4 }
1 [self.navigationBar setBackgroundImage:[UIImage new] 2 forBarMetrics:UIBarMetricsDefault]; 3 self.navigationBar.shadowImage = [UIImage new]; 4 self.navigationBar.translucent = YES;
1 - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 2 { 3 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 4 }
把tableview裏cell的小對勾的顏色改爲別的顏色git
_mTableView.tintColor = [UIColor redColor];
1 https://github.com/samvermette/SVPullToRefresh 2 3 [tableView addPullToRefreshWithActionHandler:^{ 4 // prepend data to dataSource, insert cells at top of table view 5 // call [tableView.pullToRefreshView stopAnimating] when done 6 } position:SVPullToRefreshPositionBottom];
1 unsigned int count; 2 //獲取屬性列表 3 objc_property_t *propertyList = class_copyPropertyList([self class], &count); 4 for (unsigned int i=0; i<count; i++) { const char *propertyname =" property_getName(propertyList[i]);" nslog(@"property----="">%@", [NSString stringWithUTF8String:propertyName]); 5 } 6 //獲取方法列表 7 Method *methodList = class_copyMethodList([self class], &count); 8 for (unsigned int i; i<count; i++) { method method =" methodList[i];" nslog(@"method----="">%@", NSStringFromSelector(method_getName(method))); 9 } 10 //獲取成員變量列表 11 Ivar *ivarList = class_copyIvarList([self class], &count); 12 for (unsigned int i; i<count; i++) { ivar myivar =" ivarList[i];" const char *ivarname =" ivar_getName(myIvar);" nslog(@"ivar----="">%@", [NSString stringWithUTF8String:ivarName]); 13 } 14 //獲取協議列表 15 __unsafe_unretained Protocol **protocolList = class_copyProtocolList([self class], &count); 16 for (unsigned int i; i<count; i++) { protocol *myprotocal =" protocolList[i];" const char *protocolname =" protocol_getName(myProtocal);" nslog(@"protocol----="">%@", [NSString stringWithUTF8String:protocolName]); 17