Questions tagged [viewwithtag]
33 questions
1
vote
1 answer
Why does this UIImageView think it's a UIView?
In a view controller in a storyboard I have a simple view which has a subview image with tag 0 and a subview label with tag 1.
I'm trying to get the image like this:
UIImageView *myImage = (UIImageView*)[myView viewWithTag:0];
But when I do…

soleil
- 12,133
- 33
- 112
- 183
0
votes
0 answers
Having issues(bugs) with the how the App renders in react
So the app was created with npx create-react-app. The main bug that I am not understanding is that my app renders with white spaces to the sides of the screen. I originally had the files without a specification about the vw or % of the with of the…

GustavoA17
- 11
- 3
0
votes
0 answers
How to catch a View with dinamic Tag by Espresso/Kotlin in Android?
I have a button with a tag value. Tag Value = "fix string" + int. I need to see if the button is displayed and then save the value and click on it.
onView(withTagValue(`is`("^fixString".toRegex()))).check(matches(isDisplayed())).perform(save…

Laura
- 1
0
votes
1 answer
XCTest:verify view with tag is presented
I'm adding a view with a tag in viewDidAppear but I implementing an unit test to verify the view is present in the superview but is returning nil.
Here is my testCase:
func testVerifiedViewWithTagIsLoadIt() {
let sut = ViewController()
_ =…

user2924482
- 8,380
- 23
- 89
- 173
0
votes
1 answer
Content views are not displayed on the UITableViewCell
This is a part of my storyboard:
this is my running app:
This is my part of codes:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
if…

K.B.
- 291
- 2
- 13
0
votes
2 answers
unable to find view with tag
In my viewWillAppear() I create a label and give it a tag. When another condition is met, I try to remove the label, but for some reason, that is not working and the label is still in the view. I must be doing something wrong...
override func…

erroneous switch
- 33
- 9
0
votes
2 answers
Variable not storing?
I am currently developing a tactical screen app where one can access a database to add to add players into their screens. The database is working fine, I am now trying to pass over player information into the selected position. The player…

creatando
- 25
- 1
- 4
0
votes
3 answers
cell.contentView.viewWithTag gives nil value while loading data in UITableView
I am looking to captured image tap event on the first record of UITableView, when user taps I cell.imageAvtar I just want to capture that event.
This is the code I am using
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:…

onkar
- 4,427
- 10
- 52
- 89
0
votes
1 answer
Swift: Change UISwitch status when a button is clicked on with the same tag
I have this function which gets a UISwitch with the same tag value as the button that triggers the function, and it is then meant to change the status of the UISwitch to true:
let tagToSwitch = self.view.viewWithTag(sender.tag) as?…

dhruveonmars
- 409
- 1
- 11
- 24
0
votes
1 answer
Constraints not working when using viewWithTag to get labels inside UITableviewCell
I really can't get my head around why this isn't working properly.
I have a TableViewController with dynamic prototypes. I put 4 labels in a prototype named "InfoCell", and gave them constraints.
If i run the app with the following…

Fraje90
- 3
- 3
0
votes
1 answer
Retrieve text from UITextField using viewWithTag function
I'm trying to retrieve text from a UITextField that I allow the user to create at runtime. I'm using the following line of code.
let thisTextField:UITextField = self.scrollView.viewWithTag(0) as! UITextField
The compiler error states
Could not cast…

Tom
- 790
- 2
- 9
- 32
0
votes
1 answer
SWIFT... how to loop through UIcollectionView, and getting values from the textfield into an array
so i have given the textfields a tag of 10 i want to loop through the cells of the collection view and get the values of the textfield and store them into an array... here is some code.......
override func collectionView(collectionView:…

red55
- 115
- 1
- 10
0
votes
3 answers
Everytime I scroll cell.viewWithTag will give fatal error while unwrapping found nil
I have a table view with cells everytime I scroll I get fatal error: unexpectedly found nil while unwrapping an Optional value
And it wil mark this code green: let button = cell.viewWithTag(1009) as! UIButton
override func tableView(tableView:…
user5036099
0
votes
3 answers
How can I prevent a scrollable UITableView from deallocating rows?
My problem's pretty simple.
I have a UITableViewController (well, I subclassed it, but that's not the issue), with a static layout, and it's large enough it doesn't fit on the screen all at one time.
I'm using viewWithTag to retrieve the values of a…

Parthian Shot
- 1,390
- 1
- 13
- 24
0
votes
1 answer
Adressing UILabel in UIView with viewwithtag not working
I have got a DetailViewController with a UIView (white background).
Inside this UIView I have got a couple of labels which I want to adress dynamically. So I decided to use viewWithTag
Here is my code:
UILabel *l = (UILabel*)[_bgresult…

Raphael
- 512
- 1
- 6
- 18