How to locate which header file quickly ?

0 views
Skip to first unread message

Forrest Lin

unread,
Nov 2, 2010, 1:31:27 AM11/2/10
to thr...@googlegroups.com

There are multiple modules now, one simple question would be how to locate or search header file quickly ?  any tips ?

For example , the template file for table view 

- (id) init {

  if (self = [super init]) {

    //self.variableHeightRows = YES;


    self.dataSource =

      [TTListDataSource dataSourceWithObjects:

        [[TTTableTitleItem item] applyTitle:@"Table cell item"],

         nil];

  }


  return self;

}



 How to find header file for "TTTableTitleItem" quickly ? 

Thanks 

--
      Best Regards,
      Forrest 


Matt

unread,
Nov 2, 2010, 12:32:18 PM11/2/10
to Three20
You can use Open Quickly (shift + apple + d) (it's also in the File
Menu). When the dialog comes up, start typing the name of the file.
If the name of the class appears in your code, you can select it first
and then open the dialog and the selected text should be pre-
populated.

I learned this from Mike Clark in his "Becoming Productive in Xcode"
screen cast series. Check them out at
http://www.pragprog.com/screencasts/v-mcxcode/becoming-productive-in-xcode


-Matt


On Nov 1, 11:31 pm, Forrest Lin <apple.dev...@gmail.com> wrote:
> There are multiple modules now, one simple question would be how to locate
> or search header file quickly ?  any tips ?
>
> For example , the template file for table view
>
>       - (id) init {
>
>
>
> >   if (self = [super init]) {
>
> >     //self.variableHeightRows = YES;
>
> >     self.dataSource =
>
> >       [TTListDataSource dataSourceWithObjects:
>
> >         [[TTTableTitleItem item] applyTitle:@"Table cell item"],
>
> >          nil];
>
> >   }
>
> >   return self;
>
> > }
>
>  How to find header file for "TTTableTitleItem" quickly ?
>
> Thanks
>
> --
>       Best Regards,
>       Forrest
>
>    - Skype:  forrest.shi
>    - Twitter:  twitter.com/iPadWow
>    - MSN/Gtalk : apple.dev...@gmail.com
>    -http://www.DesignForApple.com<http://www.designforapple.com>

Jeff Verkoeyen

unread,
Nov 2, 2010, 12:38:00 PM11/2/10
to thr...@googlegroups.com
If you want to then open the source file, this can be a bit tricky due to the way we copy headers in Three20 projects. Earlier this year I put together a simple script that opens the sibling file for any Three20 header, found below. I'll probably put this on Three20.info in a more accessible format soon (unless someone beats me to it).

#! /usr/bin/perl -w
# three20Sibling.pl - Find the sibling for a copied header file
# in the Three20 source.
#
# Expected use: Bind to a key like Ctrl+Shift+Up and use the hot
# key when you are in a copied Three20 header. This will open the
# sibling source file for you.
#
# Assumptions: Your Three20 output is in the following
# directory relative to the folder containing src/
# Build/Products/three20/<library name>/<header name>.h
#
# Author: Jeff Verkoeyen (jver...@gmail.com)
# Created: May 5, 2010
#

use strict;
use File::Basename;
use File::Path;

# get path to document
my $headerPath = <<'HEADERPATH';
%%%{PBXFilePath}%%%
HEADERPATH
chomp $headerPath;

if (length($headerPath)) {
    my $path = $headerPath;
    my @pathParts = split (m'/', $path);
    my $filename = pop (@pathParts);
    my $rootFileName = "$filename";
    $rootFileName =~ s/\.h$//;
    my $deepestFolder = pop (@pathParts);
    my $deepestFolderParent = pop (@pathParts);

    if ($deepestFolderParent =~ /three20/) {
      my $sibling = dirname($headerPath)."/../../../../src/$deepestFolder/Sources/$rootFileName.m";
      `open \"$sibling\"`;
    }
}

exit 0;

-------------------

Comments included in the header.

Here's how to set it up:
  1. Open Xcode
  2. Click the "script" icon in the menu, just to the left of Help
  3. Click "Edit User Scripts..."
  4. Add a new script to the "Open" group by clicking the "plus" button and clicking "New ShellScript"
  5. Copy the above source into your new script
  6. Name it something intelligible (Open Three20 Sibling)
  7. Give it a shortcut you're comfortable with, I used Ctrl+Shift+Up
  8. And you're done!

Cheers,
- Jeff


--
You received this message because you are subscribed to the Google
Groups "Three20" group.
To post to this group, send email to thr...@googlegroups.com
To unsubscribe from this group, send email to
three20+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/three20?hl=en

To learn more about Three20, check out
http://Three20.info/

Reply all
Reply to author
Forward
0 new messages