iOS Tip Calculator [closed] - cocoa-touch

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a tip calculator that displays the tip in USD in a label. This works fine.
I want to make that the user can divide the tip amout(on label) to how much persons they are.
So for example if the tip is 5 USD , and the user is with five people , then he is able to divide the tip amount to 5 , wich gives a tip of 1 USD per person.
Could someone help me please ?

If I understand your question correctly then this should help you:
In your header you will have an IBOutlet hooked up to your label (NSTextField)
IBOutlet NSTextField *myLabel;
Then somewhere in your implementation:
float myFloat = [[myLabel stringValue] floatValue];
Now that you have the float value of your label you can do your math on it.
Hope this helps.

Related

How to display an image using Xcode [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I need to know how to display an image using Xcode and Objective-C. I am using Xcode 4.5.2. I would prefer to use an empty application. Thanks.
Use UIImageView to display an image in app.
It is as simple as this,
UIImageView *imageView = [[UIImageView alloc] initWithFrame:rect];
imageView.image = [UIImage imageNamed:#"MyImage.png"];
[self.view addSubview:imageView];
You dont need a tutorial just for this. Just go through the documentation and you can figure out rest of the properties.

Use uislider to control alpha in uitextview [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How can I use uislider to control alpha in uitextview?
Please provide code.
Thanks a lot.
If you have some class with instance variables _yourTextView and _yourSlider, use:
_yourSlider.minimumValue = 0;
_yourSlider.maximumValue = 1;
_yourSlider.value = 0.0;
[_yourSlider addTarget:self action:#selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
And then, in the same class, define function:
- (void)sliderValueChanged:(UISlider *)sender {
_yourTextView.alpha = sender.value;
}
The definition of UISlider and UITextView,i believe, you can do by yourself.

Changing all table cell properties from appDelegate [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have several UITableViews and what I would like to do is to be able to change the properties of those UITableViews from a single class, which is the AppDelegate class.
Does anyone know if it would be possible to do so?
If You are using iOS5 then you can use UIAppearance
//For example this changes the background color of all UITableViews contained in a UIView
[[UITableView appearanceWhenContainedIn:[UIView class], nil] setBackgroundColor:[UIColor greenColor]];

NSArrayController - add: & remove: programmatically [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I know this is an easy one, but I just thought I could spare myself some (more) time searching through the documentation.
Usually, when I have an "Add" and a "Remove" button, along with an NSArrayController, I simply have to click-drag from each button and connect them to the add: and remove: actions of the NSArrayController.
Now, I'm trying to do the very same thing, programmatically with NSArrayController (co) :
[addButton setAction:#selector(add:)];
[addButton setTarget:co];
What am I doing wrong?
The rest of the NSArrayController operations, handling an NSMutableArray of dictionaries, etc works fine.
My psychic debugger* tells me that you're probably doing this in an init method, where neither of the outlets, to the array controller or the button, are connected yet.
Put this into awakeFromNib or a method which you know is called after the xib is loaded.
*psydb, of course.

UIButton in objective c [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
what is the function of UIButton in " UIButton *storenumber;
UIButton * is the type of the pointer. storenumber is a variable that points to an instance of the UIButton class.
As Caleb said, it is a pointer type. This is very useful whenever you have a button in your app, especially because you will need it to release the button in the dealloc method. I have also found that it is useful because you it will let you change the image, size, position, ect. of the button. If you don't know how to use these things, look at the examples below.
- (void) dealloc {
[someButton release];
}
This will release the button, thereby allowing giving you more memory to work with. The following examples are used quite often by programmers.
[someButton setHidden:(BOOL)];
[someBuuton setImage:(UIImage*) forState:(UIControlState)];
[someButton setFrame:(CGRect)];
I hope this helps!