Is it possible to load often used code lines?
Hi.
I don't know if there is a following feature.
You probably have code lines often used.
For my example,
Draw line, Create UIButton, Create UIScrollview, ... etc.
So, I have thought that I will happy if I can store the code lines and load the code lines when I need.
When I need codes draw line, I select a that feature in some place of menu of appcode.
and then I select a item named (ITEM1 : Draw line).
Or I need code lines create UIbutton. and then I select a item named
(ITEM2 : Create UIButton) in menu.
Is there that feature in Appcode?
ex) often used code items
ITEM1 : Draw line
cgc_Context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(cgc_Context, 5);
CGContextSetStrokeColorWithColor(cgc_Context, [UIColor redColor].CGColor);
CGContextMoveToPoint(cgc_Context, 0, 0);
CGContextAddLineToPoint(cgc_Context, 200, 50);
CGContextStrokePath(cgc_Context);
ITEM2 : Create UIButton
UIImage *btBack = [UIImage imageNamed:@"backBt.png"];
UIImage *btBackDn = [UIImage imageNamed:@"backBtDn.png"];
:
:
backBt.backgroundColor = [UIColor clearColor];
[backBt addTarget:self action:@selector(action:) forControlEvents: UIControlEventTouchUpInside];
[backBt setUserInteractionEnabled:YES];
ITEM3 : Create ScrollView
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 200, 100)];
view.backgroundColor = [UIColor blueColor];
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 200, 320,200)];
scrollView.scrollEnabled = YES;
:
:
[scrollView addSubview:view];
ITEM ....
ITEM N
Please sign in to leave a comment.
There is such a feature in AppCode - check Preferences->Live Templates: you can create custom snippets of code - even parameterized - and use them where necessary.
Cheers,
Anton Makeev
Thanks Anton.
Where can I get a detail information for usage of live template?