awakeFromNib is not getting called in Custom cell class due to which IBOutlets are nil











up vote
1
down vote

favorite












I am new to iOS programming.I have created a customcell class and awakefromnib method is not getting called because of this the IBOutlets are comings as nil!
It is driving me crazy! Please help!
I am using storyboards not xibs.










share|improve this question
























  • check this link stackoverflow.com/a/12629565/5362916
    – Uma Madhavi
    Jan 8 '16 at 6:57










  • Using nib or storyboard?
    – NightFury
    Jan 8 '16 at 6:58










  • @iAnum Storyboards
    – iBuilt
    Jan 8 '16 at 6:59










  • try using initWithCoder:
    – NightFury
    Jan 8 '16 at 7:01










  • Are you using initWithStyle: method? Then it won't work obviously. Please post your code for more help.
    – Sunil Chauhan
    Jan 8 '16 at 7:03















up vote
1
down vote

favorite












I am new to iOS programming.I have created a customcell class and awakefromnib method is not getting called because of this the IBOutlets are comings as nil!
It is driving me crazy! Please help!
I am using storyboards not xibs.










share|improve this question
























  • check this link stackoverflow.com/a/12629565/5362916
    – Uma Madhavi
    Jan 8 '16 at 6:57










  • Using nib or storyboard?
    – NightFury
    Jan 8 '16 at 6:58










  • @iAnum Storyboards
    – iBuilt
    Jan 8 '16 at 6:59










  • try using initWithCoder:
    – NightFury
    Jan 8 '16 at 7:01










  • Are you using initWithStyle: method? Then it won't work obviously. Please post your code for more help.
    – Sunil Chauhan
    Jan 8 '16 at 7:03













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am new to iOS programming.I have created a customcell class and awakefromnib method is not getting called because of this the IBOutlets are comings as nil!
It is driving me crazy! Please help!
I am using storyboards not xibs.










share|improve this question















I am new to iOS programming.I have created a customcell class and awakefromnib method is not getting called because of this the IBOutlets are comings as nil!
It is driving me crazy! Please help!
I am using storyboards not xibs.







ios objective-c cocoa-touch






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 8 '16 at 6:59

























asked Jan 8 '16 at 6:56









iBuilt

1617




1617












  • check this link stackoverflow.com/a/12629565/5362916
    – Uma Madhavi
    Jan 8 '16 at 6:57










  • Using nib or storyboard?
    – NightFury
    Jan 8 '16 at 6:58










  • @iAnum Storyboards
    – iBuilt
    Jan 8 '16 at 6:59










  • try using initWithCoder:
    – NightFury
    Jan 8 '16 at 7:01










  • Are you using initWithStyle: method? Then it won't work obviously. Please post your code for more help.
    – Sunil Chauhan
    Jan 8 '16 at 7:03


















  • check this link stackoverflow.com/a/12629565/5362916
    – Uma Madhavi
    Jan 8 '16 at 6:57










  • Using nib or storyboard?
    – NightFury
    Jan 8 '16 at 6:58










  • @iAnum Storyboards
    – iBuilt
    Jan 8 '16 at 6:59










  • try using initWithCoder:
    – NightFury
    Jan 8 '16 at 7:01










  • Are you using initWithStyle: method? Then it won't work obviously. Please post your code for more help.
    – Sunil Chauhan
    Jan 8 '16 at 7:03
















check this link stackoverflow.com/a/12629565/5362916
– Uma Madhavi
Jan 8 '16 at 6:57




check this link stackoverflow.com/a/12629565/5362916
– Uma Madhavi
Jan 8 '16 at 6:57












Using nib or storyboard?
– NightFury
Jan 8 '16 at 6:58




Using nib or storyboard?
– NightFury
Jan 8 '16 at 6:58












@iAnum Storyboards
– iBuilt
Jan 8 '16 at 6:59




@iAnum Storyboards
– iBuilt
Jan 8 '16 at 6:59












try using initWithCoder:
– NightFury
Jan 8 '16 at 7:01




try using initWithCoder:
– NightFury
Jan 8 '16 at 7:01












Are you using initWithStyle: method? Then it won't work obviously. Please post your code for more help.
– Sunil Chauhan
Jan 8 '16 at 7:03




Are you using initWithStyle: method? Then it won't work obviously. Please post your code for more help.
– Sunil Chauhan
Jan 8 '16 at 7:03












4 Answers
4






active

oldest

votes

















up vote
0
down vote













If you want the cell to be instantiated from a xib then you have the wrong implementation in your tableView:cellForRowAtIndexPath: method.



You need to do a few things:



First:



Ensure that the Identifier of the cell is set to a nice unique value in the xib. (n.b. cell is not a nice unique name it's just for this example)



enter image description here



Second:



In your tableView:cellForRowAtIndexPath: method ensure that you create a cell using this reuse identifier



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

// configure cell

return cell;
}





share|improve this answer




























    up vote
    0
    down vote













    Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.






    share|improve this answer




























      up vote
      0
      down vote













      I recently ran into this issue and it was due to incorrectly registering the cell. To have the UITableViewCell loaded from a nib you need to register like this:



      override func viewDidLoad() {
      super.viewDidLoad()

      // .....

      let cellNib = UINib(nibName: "YourCellNibName", bundle: nil)
      tableView.register(cellNib, forCellReuseIdentifier: "YourCellIdentifier")
      }





      share|improve this answer




























        up vote
        0
        down vote













        I also ran into this issue and the problem was I was calling:



        self.collectionView.register(CollectionCell.self, forCellWithReuseIdentifier: "CollectionCell")


        even though I had actually added the collection view cell in the storyboard. If that's the case then registering the class is unnecessary and causes all your IBOutlets to be nil when the cell is dequeued






        share|improve this answer





















          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f34671155%2fawakefromnib-is-not-getting-called-in-custom-cell-class-due-to-which-iboutlets-a%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          If you want the cell to be instantiated from a xib then you have the wrong implementation in your tableView:cellForRowAtIndexPath: method.



          You need to do a few things:



          First:



          Ensure that the Identifier of the cell is set to a nice unique value in the xib. (n.b. cell is not a nice unique name it's just for this example)



          enter image description here



          Second:



          In your tableView:cellForRowAtIndexPath: method ensure that you create a cell using this reuse identifier



          - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
          {
          UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

          // configure cell

          return cell;
          }





          share|improve this answer

























            up vote
            0
            down vote













            If you want the cell to be instantiated from a xib then you have the wrong implementation in your tableView:cellForRowAtIndexPath: method.



            You need to do a few things:



            First:



            Ensure that the Identifier of the cell is set to a nice unique value in the xib. (n.b. cell is not a nice unique name it's just for this example)



            enter image description here



            Second:



            In your tableView:cellForRowAtIndexPath: method ensure that you create a cell using this reuse identifier



            - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
            {
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

            // configure cell

            return cell;
            }





            share|improve this answer























              up vote
              0
              down vote










              up vote
              0
              down vote









              If you want the cell to be instantiated from a xib then you have the wrong implementation in your tableView:cellForRowAtIndexPath: method.



              You need to do a few things:



              First:



              Ensure that the Identifier of the cell is set to a nice unique value in the xib. (n.b. cell is not a nice unique name it's just for this example)



              enter image description here



              Second:



              In your tableView:cellForRowAtIndexPath: method ensure that you create a cell using this reuse identifier



              - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
              {
              UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

              // configure cell

              return cell;
              }





              share|improve this answer












              If you want the cell to be instantiated from a xib then you have the wrong implementation in your tableView:cellForRowAtIndexPath: method.



              You need to do a few things:



              First:



              Ensure that the Identifier of the cell is set to a nice unique value in the xib. (n.b. cell is not a nice unique name it's just for this example)



              enter image description here



              Second:



              In your tableView:cellForRowAtIndexPath: method ensure that you create a cell using this reuse identifier



              - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
              {
              UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

              // configure cell

              return cell;
              }






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jan 8 '16 at 21:35









              Paul.s

              35.7k55682




              35.7k55682
























                  up vote
                  0
                  down vote













                  Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.






                  share|improve this answer

























                    up vote
                    0
                    down vote













                    Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.






                    share|improve this answer























                      up vote
                      0
                      down vote










                      up vote
                      0
                      down vote









                      Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.






                      share|improve this answer












                      Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Sep 25 at 15:43









                      apurva kochar

                      11




                      11






















                          up vote
                          0
                          down vote













                          I recently ran into this issue and it was due to incorrectly registering the cell. To have the UITableViewCell loaded from a nib you need to register like this:



                          override func viewDidLoad() {
                          super.viewDidLoad()

                          // .....

                          let cellNib = UINib(nibName: "YourCellNibName", bundle: nil)
                          tableView.register(cellNib, forCellReuseIdentifier: "YourCellIdentifier")
                          }





                          share|improve this answer

























                            up vote
                            0
                            down vote













                            I recently ran into this issue and it was due to incorrectly registering the cell. To have the UITableViewCell loaded from a nib you need to register like this:



                            override func viewDidLoad() {
                            super.viewDidLoad()

                            // .....

                            let cellNib = UINib(nibName: "YourCellNibName", bundle: nil)
                            tableView.register(cellNib, forCellReuseIdentifier: "YourCellIdentifier")
                            }





                            share|improve this answer























                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              I recently ran into this issue and it was due to incorrectly registering the cell. To have the UITableViewCell loaded from a nib you need to register like this:



                              override func viewDidLoad() {
                              super.viewDidLoad()

                              // .....

                              let cellNib = UINib(nibName: "YourCellNibName", bundle: nil)
                              tableView.register(cellNib, forCellReuseIdentifier: "YourCellIdentifier")
                              }





                              share|improve this answer












                              I recently ran into this issue and it was due to incorrectly registering the cell. To have the UITableViewCell loaded from a nib you need to register like this:



                              override func viewDidLoad() {
                              super.viewDidLoad()

                              // .....

                              let cellNib = UINib(nibName: "YourCellNibName", bundle: nil)
                              tableView.register(cellNib, forCellReuseIdentifier: "YourCellIdentifier")
                              }






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Nov 8 at 19:27









                              Rick

                              464410




                              464410






















                                  up vote
                                  0
                                  down vote













                                  I also ran into this issue and the problem was I was calling:



                                  self.collectionView.register(CollectionCell.self, forCellWithReuseIdentifier: "CollectionCell")


                                  even though I had actually added the collection view cell in the storyboard. If that's the case then registering the class is unnecessary and causes all your IBOutlets to be nil when the cell is dequeued






                                  share|improve this answer

























                                    up vote
                                    0
                                    down vote













                                    I also ran into this issue and the problem was I was calling:



                                    self.collectionView.register(CollectionCell.self, forCellWithReuseIdentifier: "CollectionCell")


                                    even though I had actually added the collection view cell in the storyboard. If that's the case then registering the class is unnecessary and causes all your IBOutlets to be nil when the cell is dequeued






                                    share|improve this answer























                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      I also ran into this issue and the problem was I was calling:



                                      self.collectionView.register(CollectionCell.self, forCellWithReuseIdentifier: "CollectionCell")


                                      even though I had actually added the collection view cell in the storyboard. If that's the case then registering the class is unnecessary and causes all your IBOutlets to be nil when the cell is dequeued






                                      share|improve this answer












                                      I also ran into this issue and the problem was I was calling:



                                      self.collectionView.register(CollectionCell.self, forCellWithReuseIdentifier: "CollectionCell")


                                      even though I had actually added the collection view cell in the storyboard. If that's the case then registering the class is unnecessary and causes all your IBOutlets to be nil when the cell is dequeued







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Nov 16 at 11:39









                                      Nick Kirsten

                                      573519




                                      573519






























                                           

                                          draft saved


                                          draft discarded



















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f34671155%2fawakefromnib-is-not-getting-called-in-custom-cell-class-due-to-which-iboutlets-a%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Schultheiß

                                          Verwaltungsgliederung Dänemarks

                                          Liste der Kulturdenkmale in Wilsdruff