Simple Q about UIPickerView properties - iphone

Ok this is probably so simple that it's laughable, but I can't figure the answer. What is the property of the uipickerview? For the UIDatePicker, its datePicker.date, for label you can do label.text, etc etc. Is there a pickerView.XX syntax where I can get the value selected similar to the datePicker? Please let me know. Thanks

selectedRowInComponent:
You probably missed it b/c it isn't a property.

Related

why is adjustsLetterSpacingToFitWidth not working?

I want to let label show itself and fit the string in it to the label width.in other words. I use the property adjustsLetterSpacingToFitWidth to do so. But the string still show on the left of label.Why? Is there any other solutions to do so?
It sounds like you want:
[myLabel sizeToFit];
Check out this answer to see if it helps.

Why cant I display the layer property value of Uibutton

I was just experimenting with layer property of my UIButton by setting a outlet n the code for a button created in xib.
NSLog(#"d button layer value%#",dButton.layer.backgroundColor);
But the output is coming as:
d button layer value(null)
My question is: can't we display the layer property value of UIButton. We all know that some default value would have been set for the button.
According to the documentation for CALayer:
The default is nil.
unless you explicitly change it.
In the documentation for UIView, it says this:
The default value is nil, which results in a transparent background color.
This excerpt describes the view.backgroundColor property, so I assume that the view.layer.backgroundColor property is the same.
Hope this helps!
Phew !! I finally got the answer.
Actually I was trying to display the structure value using %# in NSlog statement.
dButton.layer.backgroundColor is a fundamental data type used internally by Quartz to represent colors.
So, way to display them is to make your own class which can parse the value.
Like, for example there are class functions for CGRect, CGPoint etc
like for displaying CGRect we use this code
NSLog(#"d button layer value%#",NSStringFromCGRect(dButton.layer.bounds));
but there arent any function defined for CGColorRef.
Ok, as per jrturton said,for displaying the above value we can use
NSLog(#"d button layer value%#",[UIColor colorWithCGColor:button.layer.backgroundColor)]
I hope everyone got it now !!

Implementing tree structure UITableview

Can We create tree structure in UITableView like below.
-Sub1 //First row
-Sub1sub1 //First row's child
-sub1sub1sub1 //Child's child etc..
-sub1sub1sub2
-Sun1sub2
-sub2sub2sub1
-sub2sub2sub2
-Sub2
-Sub2sub1
-sub1sub2sub1
-sub1sub1sub2
-Sun2sub2
-sub2sub2sub1
-sub2sub2sub2
Don't want any code but is there any reference for implementing this..or just let me know is it possible or not..
Please help me to solve this question..
Thanks in advance.
Finally I got my answer..
Using this Github link
Thanks Github...
TableView delegate method
tableView:indentationLevelForRowAtIndexPath:
can be used to indent rows according to your needs
I've done it before, and using this approach helped me a lot:
Implementing UITableView Tree Structure
If you need help of how to implement that solution, or if it doenst fit your problem, let us know and we will help you
Edit: I just realized you have one more level of depth that the link, but in your case you can use a header for the first level)

how can I show only number format input in UITextField?

I am making simple application that will take hotel name and price of item, and I want to show the price in only number format, because it can not be in alphabatical format, so what should I do add in code so that only number will be inputted in the Price UITextField?
If you are not getting my question, you may ask anything again
I do appreciate if I will get proper way of doing this,
If you want your text field to accept only the numbers, you can set it's keyboardType property to UIKeyboardTypeNumberPad.
[yourTextField setKeyboardType:UIKeyboardTypeNumberPad];
There are different types of keyboardTypes available, which you can refer in UITextInputTraits Protocol Reference.
This could be done in the Interface Builder as well:

How to make UITableView show current item?

I have an array filled with dictionaries.
Each dictionary have strings like title, info and date.
Cells in the table are arranged by the date from the dictionary.
What should I do to make it show the cell as active if the date field in dictionary=current date or closest date in the future?
Thanks in advance! I'd really appreciate your help!
I am assuming that you want to somehow highlight the current date. A simple thing would be to select the cell using [cell setSelected:YES animated:YES]. An other thing would be setting the accessoryType to UITableViewCellAccessoryCheckmark ([cell setAccessoryType:UITableViewCellAccessoryCheckmark]). If you don't like these approaches, you can still create a custom UITableViewCell with support of some sort of highlighting, like showing an arrow in the cell.