当前位置: 编程技术>移动开发
本页文章导读:
▪NSObject种所支持的一些基本方法 NSObject类所支持的一些基本方法
NSObject类所支持的一些基本方法对象是否class-object或其子类的成员?-(BOOL) isKindOf:class-object对象是否class-object的成员?-(BOOL) isMemberOfClass:class-object对象是否能.........
▪ 检测内存储器 检测内存
//检测内存
void report_memory(void) {
static unsigned last_resident_size=0;
static unsigned greatest = 0;
static unsigned last_greatest = 0;
struct task_basic_info info;
mach_msg_type_number_t size = sizeof(i.........
▪ UITabBarController撤除再次点击已选中tab时回到UINavigationController的rootViewController UITabBarController取消再次点击已选中tab时回到UINavigationController的rootViewController
设置tabBarController的delegate, 并实现delegate中的tabBarController:shouldSelectViewController方法
- (BOOL)tabBarController:(UITabBarContr.........
[1]NSObject种所支持的一些基本方法
来源: 互联网 发布时间: 2014-02-18
NSObject类所支持的一些基本方法
NSObject类所支持的一些基本方法
对象是否class-object或其子类的成员?
-(BOOL) isKindOf:class-object
对象是否class-object的成员?
-(BOOL) isMemberOfClass:class-object
对象是否能够响应selector所指定的方法?
-(BOOL) respondsToSelector:selector
指定的类实例是否能够响应selector所指定的方法?
+(BOOL) instancesRespondsToSelector:selector
对象是指定类的子类吗?
+(BOOL) isSubclassOfClass:class-object
应用指定方法
-(id) performSelector:selector
应用指定方法,传递参数object
-(id) performSelector:selector withObject:object
应用指定方法,传递参数object1和object2
-(id) performSelector:selector withObject:object1 withObject:object2
NSObject类所支持的一些基本方法
对象是否class-object或其子类的成员?
-(BOOL) isKindOf:class-object
对象是否class-object的成员?
-(BOOL) isMemberOfClass:class-object
对象是否能够响应selector所指定的方法?
-(BOOL) respondsToSelector:selector
指定的类实例是否能够响应selector所指定的方法?
+(BOOL) instancesRespondsToSelector:selector
对象是指定类的子类吗?
+(BOOL) isSubclassOfClass:class-object
应用指定方法
-(id) performSelector:selector
应用指定方法,传递参数object
-(id) performSelector:selector withObject:object
应用指定方法,传递参数object1和object2
-(id) performSelector:selector withObject:object1 withObject:object2
[2] 检测内存储器
来源: 互联网 发布时间: 2014-02-18
检测内存
//检测内存 void report_memory(void) { static unsigned last_resident_size=0; static unsigned greatest = 0; static unsigned last_greatest = 0; struct task_basic_info info; mach_msg_type_number_t size = sizeof(info); kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size); if( kerr == KERN_SUCCESS ) { int diff = (int)info.resident_size - (int)last_resident_size; unsigned latest = info.resident_size; if( latest > greatest ) greatest = latest; // track greatest mem usage int greatest_diff = greatest - last_greatest; int latest_greatest_diff = latest - greatest; NSLog(@"Mem: %10u (%10d) : %10d : greatest: %10u (%d)", info.resident_size, diff, latest_greatest_diff, greatest, greatest_diff ); } else { NSLog(@"Error with task_info(): %s", mach_error_string(kerr)); } last_resident_size = info.resident_size; last_greatest = greatest; }
[3] UITabBarController撤除再次点击已选中tab时回到UINavigationController的rootViewController
来源: 互联网 发布时间: 2014-02-18
UITabBarController取消再次点击已选中tab时回到UINavigationController的rootViewController
设置tabBarController的delegate, 并实现delegate中的tabBarController:shouldSelectViewController方法
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
AppUtilsLog(NSStringFromSelector(_cmd));
UIViewController* selectedViewController = tabBarController.selectedViewController;
if (selectedViewController == viewController) {
return NO;
} else {
return YES;
}
}
最新技术文章: