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.
ios objective-c cocoa-touch
|
show 7 more comments
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.
ios objective-c cocoa-touch
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 usinginitWithCoder:
– 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
|
show 7 more comments
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.
ios objective-c cocoa-touch
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
ios objective-c cocoa-touch
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 usinginitWithCoder:
– 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
|
show 7 more comments
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 usinginitWithCoder:
– 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
|
show 7 more comments
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)
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;
}
add a comment |
up vote
0
down vote
Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.
add a comment |
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")
}
add a comment |
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
add a comment |
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)
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;
}
add a comment |
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)
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;
}
add a comment |
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)
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;
}
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)
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;
}
answered Jan 8 '16 at 21:35
Paul.s
35.7k55682
35.7k55682
add a comment |
add a comment |
up vote
0
down vote
Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.
add a comment |
up vote
0
down vote
Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.
add a comment |
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.
Make sure that you have the appropriate module (and not none) for the Custom Class of UICollectionViewCell.
answered Sep 25 at 15:43
apurva kochar
11
11
add a comment |
add a comment |
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")
}
add a comment |
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")
}
add a comment |
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")
}
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")
}
answered Nov 8 at 19:27
Rick
464410
464410
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Nov 16 at 11:39
Nick Kirsten
573519
573519
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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