Is it possible to load often used code lines?


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);

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 ....


Comment actions Permalink

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.
Anton Makeev

Comment actions Permalink

Thanks Anton.

Where can I get a detail information for usage of live template?


Please sign in to leave a comment.