I do not want my iPhone slider to return simple numbers like 1, 2, 3, etc. to the text label, but 15mm, 15.5mm, 16mm, etc., from 15mm to 45mm in increments of .5. So I thought I would put all the acceptable numbers in an array and link the slider output with the corresponding object in the array. (Slider returning "0" will link to the first element of the array, etc.)
Here is how I've tried to link the output to the array, and the warning it generated (line 5, for line 4): - -(void)sliderAction:(id)sender{
-
NSArray *array = [NSArray arrayWithObjects: @"15", @"15.5", ..., @"45", nil];
-
NSString *labelValue; // This var will pass the value to the text label
-
labelValue = [array objectAtIndex:slider.value]; // Slider will pass a number from 0-59
-
// warning: passing argument 1 of 'objectAtIndex' makes integer from pointer without a cast
-
label.text = [NSString stringWithFormat:@"%02.0fmm", labelValue]; // The array number and "mm" will be sent to the text label
-
[labelValue release]; // release the memory
-
}
How do I change the type from a number to a string (I think that's what will take away the warning)? I've been coding in Obj-C for the last three months, and came from a PHP background.
Thanks!
Steve
2 4002
Why not just multiply the number returned by 5?
I am not at my pc now, but I think there is a stringwithforma t: that accepts an int.
I will use several sliders in the app, and not all the sliders will return numbers as consistently spaced as these. Another array will have numbers that seem to be at random. That's why I'm using an array. If I get this one right, I'll get them all right.
I don't see how multiplying an integer by 5 can get me 15.5.
Thanks!
Steve
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: j_mckitrick |
last post by:
Hi all!
I've heard good things about SmallTalk, and I read that the IDE is
extremely productive. Why is this the case? What are the technical
points where Python and SmallTalk differ? Is SmallTalk really faster
than Python?
I tried Objective-C, but eventually dropped it for lack of support and
the need to use NS-type classes to do anything productive. Python's
built in containers and types are so much more concise. But if
|
by: edo |
last post by:
JS program to score any objective test
http://www.psychology.org/cgi-bin/links2/jump.cgi?ID=3913
|
by: David |
last post by:
Anyone know of objective a survey of the development time and run-time
considerations of PHP vs. ASP.NET vs JSP? Most arguments for one
environment appear to be more on the personal level.
Thanks
P.S.
I guess I would like to see a test app given to three programmers with
1-2 years in their specific environment and see the time taken to
|
by: bloc |
last post by:
I am programming an interactive CV using xml, xslt and java script. The
page consists of a header which contains links to various 'sections' on
the xml cv, a left and right menu, and a central panel. The central
panel is intended to display the main content of the cv: when an anchor
is selected from the header then the detail is supposed to appear. The
javascript is supposed to select the appropriate section 'onclick' and
output it....
|
by: support |
last post by:
Hi,
I am trying to change the text of a Command button using the Windows
API Function SetWindowText, which I have declared as follows:
<DllImport("User32")_
Public Function SetWindowText(ByVal hWnd As IntPtr, ByVal
lpString As String) As Boolean
End Function
| |
by: Genki |
last post by:
Can you figure out how to do this in Access2002/VBA?
I want to get the value of an object property. The trick is that the name of the property to retrieve is stored in a table.
Here's how I've set it up:
I have a class module "objPerson" which has a property "FirstName".
This works:
objPerson.FirstName = "John Smith"
strFirstName = objPerson.FirstName
|
by: aaragon |
last post by:
Hi everyone,
I've been writing some code and so far I have all the code written in
the .h files in order to avoid the linker errors. I'm using templates.
I wanted to move the implementations to the .cpp files. After some
reading, I found that the only way to do this is to add the actual
template instantiations in the .cpp file. But, how do you do that if
you're not working with built-in types? For example, a template class
might be,
|
by: Arjen |
last post by:
Hi,
Form a performance perspective, is it wise to use the ref statement as much
as possible?
Thanks!
Arjen
|
by: babu8880 |
last post by:
www.convensysglobal.com/elearn You can login and attend courses and
similar resources ask your doubts from experienced engineers in iphone
and Objective C Domain
You can attend live classes through our website with experienced
teachers available world wide. Some among you can also be teachers
while others will be your students. This is fun and adds knowledge in
the domain of i-Phone Development. We request all users to be active
in...
|
by: wayneface |
last post by:
hey guys im quite new to programming and have been teaching myself c, ive come to the point where object orientated languages are calling to me but i can't decide weather to go onto objective - c or c++ i own both a new mac and a windows vista pc. iv'e been doin all my c stuff on xcode on my mac so the obvious path seems to be objective - c but i dont wanna make the wrong decsision, what should i do?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |