Skip to content

Instantly share code, notes, and snippets.

Avatar
😆
LeL

cemck

😆
LeL
View GitHub Profile
View UIView.m
UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 35)];
newView.backgroundColor=[UIColor redColor];
UITextView *mytext = [[UITextView alloc] initWithFrame:CGRectMake(5.0, 0.0, 100.0, 28.0)];
mytext.backgroundColor = [UIColor clearColor];
mytext.textColor = [UIColor blackColor];
mytext.editable = NO;
mytext.font = [UIFont systemFontOfSize:15];
mytext.text = @"Mytext";
mytext.scrollEnabled=NO;
@cemck
cemck / listSubviews.m
Last active May 24, 2019
objc - list all subviews of some view
View listSubviews.m
- (void)listSubviewsOfView:(UIView *)view {
// Get the subviews of the view
NSArray *subviews = [view subviews];
// Return if there are no subviews
if ([subviews count] == 0) return; // COUNT CHECK LINE
for (UIView *subview in subviews) {
// Do what you want to do with the subview
NSLog(@"%@", subview);
You can’t perform that action at this time.