Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Some questions about the Crystal ball app xcode

How is the .m code generated?

@implementation ViewController

    - (void)didReceiveMemoryWarning
    {
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
    }

    #pragma mark - View lifecycle

    - (void)viewDidLoad
   {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
   }

  - (void)viewDidUnload
  {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
  }

    - (void)viewWillAppear:(BOOL)animated
 {
    [super viewWillAppear:animated];
 }

  - (void)viewDidAppear:(BOOL)animated
 {
    [super viewDidAppear:animated];
 }

    - (void)viewWillDisappear:(BOOL)animated
   {
    [super viewWillDisappear:animated];
  }

   - (void)viewDidDisappear:(BOOL)animated
   {
    [super viewDidDisappear:animated];
   }

    - (BOOL)shouldAutorotateToInterfaceOrientation:    (UIInterfaceOrientation)interfaceOrientation
    {
    // Return YES for supported orientations
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    }

When I open up a new project all I get in the .m is this:

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

2 Answers

OMG sorry that looks so messy!! I was having a hard time knowing the correct amount of spaces to put in to make a code block!

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Hi @Julia,

In the future, you can just surround your code with three backticks before and after it. You can optionally add a language, too, like this:

```objc

NSString *test = @"This is a test";

```

gives:

NSString *test = @"This is a test";