I want to edit corresponding labels when the user selects a row.
i have 3 labels in each row in my 1stView . i want to edit the text of those labels
navigating to the another view and there i need to edit those labels text.
one of my labels text is getting from UItextfield declared on the 2nd view and the other 2 labels text is getting from uibuttons title on the the 2nd view.
Now i want to show the labels text in my 2nd view for editing the text pf those three fields??
for more clear i will ellobrate
I have a table in my 1st view, when i click on add button am loading another view(2nd view) where it contains 1 textfield and 2 buttons. I am setting the text of these three fields to my 1stview my each tableviewcell has 3 labels created in each row.
How can i edit those 3 fields??
I would suggest you to make the required strings accessible in both Class1 as well as Class2. So that when you want to get the text from Class2 you can save those strings in your stringVariable and can thus pass on the values to Class1 as well..
After Question Edit:
I will again suggest you to take 3 string variable in class1 and make it accessible in class 2... While you go to class 2 in edit mode/ add new mode you can save the text of textfield and button titles in the 3 strings and can access the same in Class1 and display it in table's cell in Class1. Hope I make it more clearer now
Related
I have created a 100×100 table by default only 20×20 cell of table is shown, also I have an editfeild component when user input :goto AA20 or other select cells the view of table will change and will show that cell and cells around it
Like this:
When i write goto AA20 in edit field it should show this view
I need help to write this .
Best regards*
I am showing data in tableview and on editing it will be as in image. (i had allowed editing only for rows those were come after 4 th index).
Now i want to first four image cell frame as in the below reference image.
And i last i need the output as in the below reference image
.
If any suggestion or references for this problem.
Thanks
For the first four cells, set a transparent image to cell.imageView.image This is not the perfect answer by any means but this will do the trick you want.
OR
For the four cells you can set the cell.textLabel.text by adding few spaces upfront like,
cell.textLabel.text = #" YOUR TEXT";
Your question is not clear.
I think you need the text alignment of all cells in same manner. If it is the case, I'll suggest three options:
When editing is pressed reload the tableView and add necessary spaces for first 3 rows
If you are using custom cells make another one for first three cells with exact spaces
If you are adding UILabel as subview of these cells change the frame
You can create the following by creating two sections in the UITableView , where for the second view you can set the editing TRUE (not in first section) . Also pass the title for second section as "On My Pad" as shown in your reference image .
Hope it will help you !
Hi
I have some text field which, after a decoding, set some UILabel. The problem is that if the user leave some empty field , I don't like to see that space between the labels. I enclose a picture for a better understanding. thanks in advance.
instead of the view below use a uitableview with custom cells
Each custom cell having a label ...and add a cell if and only if u have a valid string in a textfeild..set userinteraction=NO and set some backgroung color to match ur view..
just put that string in the uilabel in the custom cell...thats it..
So I have many labels in my app that contain the same text. I am localizing them, and would like to know if its possible for me to tag them all with the same number and assign the new text that way.
currently when I have tested it only recognizes the first label with the tag.
I really want to save myself from having all these repeat outlets
Yes,
You can tag them with a integer number because in inheritance tree NSObject is the super class to UIView,
And NSObject has an integer property called tag .
USE tag like below
myLabel1.tag = 1;
myLabel2.tag = 2;
...........
...........
myLabeln.tag = n;
It is a little inclear from your question what your problem is, but I am assuming from your question that you want to be able to update all your UILabels which are located at different places within your app with the same text.
You could create a global header file that contains an NSString which holds the text for all your labels, and then #include this header in all view controllers which contain labels which need to show this this text. Then whenever you update the NSString in the global header you update any labels that are currently in view or about to be viewed aswell. This can be done from within your IBAction methods, as well as implimenting the viewWillAppear:(BOOL)animated method. Whenever a view that contains relevent labels comes into view, it will apply the value of the NSString in your global header and update its labels.
Basically what I am trying to do is:
1) The user sets the number of choices he wants e.g. 3 choices which are "A", "B", "C"
[Done this]
2) The next view is loaded and the right amount of boxes are created, 3 in this case. The boxes need to be blank at first and then the user enters their choices into the boxes.
e.g. "A", "B", "C"
Note: I tried create multiple text boxes automatically, but I found that after about 6 boxes the screen wouldn't scroll and therefore looked very tacky
3)At a click of a button, one of the textboxes is selected randomly. The inputed data from this randomly selected box is then displayed in NSLog or Label or file, which i will then use in another view.
Thanks
Dan
Hey, you could make a scrollView out of the 2th view. That way, you can still automatically create textfields, and the screen will scroll. Check out this link for more information on how to create a scrollview. Perhaps you can make the scrollview's size dynamically (depending on how much textfields you have).
About selecting a random textfield, use arc4random() More about that can be found here.