ios - Registering Custom Collection View Cell in UIView -


I have the same code from its answer. I am trying to implement a custom view cell and it is doing this and works as long as it inserts the cell and tries to allocate the properties of my custom view cell (because it is now Also sees the cell as UICollectionViewCell instead of custom vivekel).

    - [UICollectionViewCell imageView]: unrecognized selector sent to instance 0x1658c540

    / code>

    I UIViewController Instead, calling the collection view in a UIView, there is no class method for viewDidLoad. I tried to implement the register in a method which I know is called for the first time.

    How do I manage to register a Custom Cell Class? And for that matter, how do I create a method that walks once in the beginning of a viewDidload method?

    I know that more code is necessary; I will update the question

    EDIT_1:

    On the exit, I was declaring it in the old code. However, @Vyat I had the necessary argument, although it seems that NSLog does not participate for that method. Anyway I came to know that I was entering some old code twice, I was not working at that time, which was said after the Init. @Neil's answer is also correct. Thanks guys!

    After the

    log you are told that is not UICollectionViewCell not aware that ImageView , it's saying correctly that you are making UICollectionViewCell items, instead of CustomViewCell The logs report the actual class of the object, and not what can be done in the code.

    You can either UICollectionView or failing to make the right kind of cell

      UICollectionView * collectionView = [[UICollectionView alloc] init ... // omitted [collectionView registerClass: [CustomViewCell class] forCellWithReuseIdentifier: @ " CustomIdentifier "];  

    Getting cells cellForItemAtIndexPath: :

      CustomViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier: @ "CustomIdentifier" forIndexPath: indexPath ];  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -