Memory use and cpu time can be available like below.
Programmatically retrieve memory usage on iPhone
And also i'd like to know the number of views to check performance? Is it possible?
Memory use and cpu time can be available like below.
Programmatically retrieve memory usage on iPhone
And also i'd like to know the number of views to check performance? Is it possible?
I solved myself. call countViewsInApp. thx.
+ (int)countViewsInApp {
int num = 0;
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
for (UIView *aView in [window subviews]) {
num++; // parent
num += [self countSubviews:aView];
}
}
return num;
}
+ (int)countSubviews:(UIView *)view {
int num = 0;
for (UIView *subview in [view subviews]) {
num++;
if ([[subview subviews] count] > 0) {
num += [self countSubviews:subview];
}
}
return num;
}
You can do like that:
- (NSUInteger *)countSubviewsInViewСonsideringView:(UIView *)view {
NSUInteger subviewsCount = 1; // the current view
for (UIView *subView in view.subviews) {
subviewsCount += [self countSubviewsInViewСonsideringView:subView]
}
return subviewsCount;
}
somewhere in code:
UIWindow* window = [[UIApplication sharedApplication] keyWindow];
NSUInteger count = [self countSubviewsInViewСonsideringView:window];