Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tableview cell #142

Open
yestoall opened this issue Nov 20, 2013 · 7 comments
Open

tableview cell #142

yestoall opened this issue Nov 20, 2013 · 7 comments

Comments

@yestoall
Copy link

i'm having this runtime error:

layout.rb:273:in top_level_view': No default view has been defined for SearchCell. Implementtop_level_view`. (RuntimeError)

in my custom UITableViewCell class i have this

def initWithStyle style, reuseIdentifier: identifier
    super

    layout(self.contentView, :searchy) do
        @photo = subview(UIView,:cell_photo)
        @title = subview(UILabel,:cell_title)
        @year  = subview(UILabel,:cell_year)

        auto do 
            metrics "margin" => 20

            vertical "|-margin-[cell_photo(==110)]-(=>1)-|"
            vertical "|-margin-[cell_title(==20)]-margin-[cell_year(==20)]-margin-|"

            horizontal "|-margin-[cell_photo(==60)]-(=>1)-|"
            horizontal "|-margin-60-[cell_title]-margin-|"
            horizontal "|-margin-60-[cell_year]-margin-|"
        end
    end
    self.accessoryType  = UITableViewCellAccessoryNone
    self.selectionStyle = UITableViewCellSelectionStyleNone

    self
end

i don't know which parameter i need to send to my auto layout

@yestoall
Copy link
Author

yestoall commented Dec 5, 2013

is anybody out there? ;)

@colinta
Copy link
Owner

colinta commented Dec 5, 2013

The top_level_view method is defined for all UIView subclasses, so this error is either very strange, or easily solved by fixing SearchCell's parent class.

@yestoall
Copy link
Author

yestoall commented Dec 6, 2013

is very strange... the parent class with the UITableView is also a auto layout.
i can't find the bug and i'm not using auto layout to work ok.

@colinta
Copy link
Owner

colinta commented Dec 6, 2013

wat? sorry, i don't follow that sentence...

If you can include the source files (the table view delegate and table cell classes should be enough) i'd be happy to take a look, see if anything jumps out at me.

@yestoall
Copy link
Author

yestoall commented Dec 6, 2013

sorry about my english, my spanish is better :)

more readeable now: https://gist.github.com/yestoall/7828487

@colinta
Copy link
Owner

colinta commented Dec 6, 2013

K let's see here, one thing that I notice is you are including Teacup::Layout, but that is already included by the UIView class. Not sure what happens when you include it twice, but you don't need to, anyway.

 class SearchCell < UITableViewCell
-  include Teacup::Layout
   stylesheet :search

@colinta
Copy link
Owner

colinta commented Mar 19, 2014

Can you include a project that reproduces this error? I don't have time to create a project that has this same error. I'm using Teacup to create/style UITableViewCells and have never seen this error, though I suspect it's related to using the auto method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants