Questions tagged [viewwithtag]

33 questions
10
votes
6 answers

Why is UItableViewCell viewWithTag returning nil?

I am using IOX8 and Xcode 6. I created a table with a customtype cell in storyboard, and I placed a label in it. I entered a tag number for the label in the IB, so that I could retrieve a reference to the label in my code. But when I try to get a…
malena
  • 798
  • 11
  • 26
5
votes
1 answer

Can I customize existing viewWithTag:(NSInteger) method for stringTag?

Please help me, I have been customizing a UIView class to set NSString value as a tag, but how can I get that view from view hierarchy.In UIView class default method to get view is viewWithTag:(NSInteger). Please see below code #import…
iamVishal16
  • 1,780
  • 18
  • 40
5
votes
2 answers

XCode 6 UICollectionview viewwithtag not working

Seems XCode 6 is different in using viewwithtags then XCode 5 was. I am using the following code in XCode 6 with Storyboards. 50 cells are created but the label is not visible.Everything is set correctly like the tag etc. If I use the "old" XCode 5…
Ben
  • 650
  • 2
  • 12
  • 23
4
votes
1 answer

How to get iCarousel current visible view?

I am using iCarousal in which I have to use three webviews,five imageviews and two Labels on my iCarousal views a total of 10 iCarousal views.What I need to do is fetch the labels,webviews and imageviews on the basis of tag in the below method and…
Imran
  • 1,715
  • 2
  • 20
  • 42
3
votes
2 answers

Change UIView based on viewWithTag in Swift3

In Objective C it was easy to change the image of a UIView based on a tag using a cast to (UIImageView*) — something like: [ (UIImageView*) [self.view viewWithTag:n+1] setImage:[UIImage imageNamed:@"bb.png"]]; I've been trying to find an…
johnrpenner
  • 175
  • 1
  • 8
3
votes
1 answer

viewWithTag returns nil for UITableViewCell

I have a UITableView with a prototype UITableViewCell with the identifier contact. In interface builder, I built the cell correctly and have all the elements set to the right tags. When I try to edit a UILabel in the cell that has the tag 101 using…
jamespick
  • 1,974
  • 3
  • 23
  • 45
2
votes
2 answers

how to use ViewWithTag in Swift?

I'm new to Swift, however I work in Objective-C before. I'm having issue in checkin if the cell is being reused in UITableView or not. let cell = tableView.dequeueReusableCellWithIdentifier(strCellId, forIndexPath:indexPath) as!…
Hiren Prajapati
  • 717
  • 3
  • 10
  • 25
2
votes
1 answer

Why there is no warning while casting with viewWithTag?

For example, UIImageView *iconView = [cell.contentView viewWithTag:TestTag]; I remember that if I don't cast the type explicitly there will has warning before, but now Xcode doesn't show that, and my Xcode version is 7.1.1, is that a new feature…
cajsaiko
  • 1,017
  • 1
  • 8
  • 15
1
vote
2 answers

Using a Swift enum as view tag numbers without rawValue

I have an integer enum which I'd like to use for the viewWithTag(_:) number, but it gives me the error "Cannot convert value of type 'viewTags' to expected argument type 'Int'", even though both the enum and the tag number needed in viewWithTag(_:)…
Chewie The Chorkie
  • 4,896
  • 9
  • 46
  • 90
1
vote
2 answers

How to change an image with a "viewWithTag" programmatically?

I'm currently working with nibs need to change the images based on their tag programmatically based on country. I've tried: vc.view.viewWithTag(8).image = UIImage(named:"image") but it throws an error "Value of type UIView has no member image",…
SwiftyJD
  • 5,257
  • 7
  • 41
  • 92
1
vote
3 answers

tableview viewWithTag not retrieving UIElements objective-c

I am doing using some code that I have seen work before. Essentially a user answers yes or no on a post with some buttons. Pressing yes or no updates the database, which is working correctly, and it also updates the visible UI, which is not working.…
Kyle Griffith
  • 607
  • 1
  • 6
  • 12
1
vote
1 answer

viewWithTag always returns nil in child view controller

I was using [self.view viewWithTag] in order to reference objects within a UIViewController. I then proceeded to move a specific subview to a new UIViewController, then adding it as a child view controller and adding the view as a subview. However,…
Charles
  • 4,372
  • 9
  • 41
  • 80
1
vote
2 answers

UICollectionView cell.ViewWithTag returning nil for UILabel

This label seems to return nil, even though I have the reuseIdentifier and tag set properly. override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { var identifier:…
1
vote
3 answers

How to change UILabel text color on Custom UITable cell?

I've created a table view controller on storyboard. I want to change UILabel text color to green when i clicked on the selected row. I'm trying something like this, but it's not working: - (void)viewDidLoad { [super viewDidLoad]; menuItems =…
1
vote
1 answer

viewWithTag: returns nil after reloadData

I have tableView with 6 rows made with a custom cell. The custom cell has a UILabel and a UISwitch. In the method "cellForRowAtIndexPath:" I have: static NSString *CellIdentifier = @"optionsCell"; UITableViewCell *cell = [tableView…
Corrado
  • 505
  • 1
  • 5
  • 18
1
2 3