Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-06-2009, 03:55 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 16
Default Making programatic changes to UIImageView Width/Height

How do I programatically make changes to the width/height of a UIImageView? This would be a single instance of the view but would have different sizes depending on which button the user selects on-screen. I can get it to display the first time with the place and size I want but then it needs to change size and I'm not finding a way to access width/height numbers without doing a CGRectMake again. I already initialized it so doing it a second time would create a second view in addition to the first. I guess I'm looking for a:

myImageView.w = 10;
myImageView.h = 20;

type deal. Any thoughts?
monty747 is offline   Reply With Quote
Old 11-09-2009, 07:13 AM   #2 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Pune, India
Posts: 314
Send a message via Skype™ to Akshay Shah
Cool

Quote:
Originally Posted by monty747 View Post
How do I programatically make changes to the width/height of a UIImageView? This would be a single instance of the view but would have different sizes depending on which button the user selects on-screen. I can get it to display the first time with the place and size I want but then it needs to change size and I'm not finding a way to access width/height numbers without doing a CGRectMake again. I already initialized it so doing it a second time would create a second view in addition to the first. I guess I'm looking for a:

myImageView.w = 10;
myImageView.h = 20;

type deal. Any thoughts?

You need to set a complete frame of the imageView.
For the above values it will be done as
Code:
[myImageView setFrame:CGRectMake(myImageView.frame.origin.x, 
myImageView.frame.origin.y,10,20)];
Hope this helps...

Regards,
Akshay Shah.
__________________
If you think I did help you, you can always thank me by buying
iHoldMore - A very nice and addictive game...

Need a mobile app. Contact Us.
Ruby Solutions Pvt. Ltd.
You can mail me at akshay@ruby-solutions.com
Akshay Shah is offline   Reply With Quote
Old 11-10-2009, 04:10 PM   #3 (permalink)
Humbled Student
 
Dutch's Avatar
 
Join Date: Apr 2009
Location: Long Island, NY
Age: 32
Posts: 883
Send a message via AIM to Dutch
Default

I really hate it when people ask questions that have answers that are SO easily findable by reading the most basic of apple's documentation... They register for a user account, they ask the question, make it OBVIOUS they are too lazy to read page one of anything, they get their answer and they are never heard from again.

Akshay, you are a better man than I - I would not have answered this absurdity.
Dutch is offline   Reply With Quote
Old 07-11-2010, 06:22 PM   #4 (permalink)
LordBrian
 
Join Date: Sep 2009
Posts: 11
Default

Quote:
Originally Posted by Dutch View Post
I really hate it when people ask questions that have answers that are SO easily findable by reading the most basic of apple's documentation... They register for a user account, they ask the question, make it OBVIOUS they are too lazy to read page one of anything, they get their answer and they are never heard from again.

Akshay, you are a better man than I - I would not have answered this absurdity.
I take it your application to work at the Samaritans was turned down
LordBrian is offline   Reply With Quote
Old 07-11-2010, 08:41 PM   #5 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 4,795
Default

Quote:
Originally Posted by LordBrian View Post
I take it your application to work at the Samaritans was turned down
I agree with Dutch.

There are a lot of incredibly lazy people on these forums. They ask questions the answer to which are quite well documented, and make it clear they have spent zero time trying to figure out the answer for themselves.

I also hate it when people say "I want to write an app that does a, b, and c. Can you post example code that does that?"

It gets really old.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 07-12-2010, 01:17 AM   #6 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 16
Default

Quote:
Originally Posted by Duncan C View Post
I agree with Dutch.

There are a lot of incredibly lazy people on these forums. They ask questions the answer to which are quite well documented, and make it clear they have spent zero time trying to figure out the answer for themselves.

I also hate it when people say "I want to write an app that does a, b, and c. Can you post example code that does that?"

It gets really old.

As long as I am going to be notified of the replies to a message I originally posted (and initially received a kind & helpful answer to) 8 MONTHS AGO, I feel the need to respond.

First of all, I apologize for the stupid question. With all the people willing to help (here, with web site tutorials and YouTube videos) I didn't think I needed to pass a basic skills test first before opening my mouth.

I did finish this app and it is available in the App Store. You might be interested to know that the answers to the questions I received was a very small percent of all the code I wrote over a period of a few months. Lazy you say? No. I had never written an application before. It's been a learning experience every day. I appreciate the help I received from those willing to give it.

Second, your claim that my post asks for an entire app to be written from a line of code is absurd. Nobody in here is asking for that. You make it sound like I copy & paste the answer to my question:
[myImageView setFrame:CGRectMake(myImageView.frame.origin.x,
myImageView.frame.origin.y,10,20)];
into xcode and hit Build&Go and I have a working app. Clearly impossibly!

Some of the people here are beginners (like me) who are asking for help with pieces of their code, not the entire thing. We are learning just like you did when you started out. If you want to help us, great. If not, please keep your replies to the posts you feel are worthy of your response.
monty747 is offline   Reply With Quote
Old 07-12-2010, 02:29 AM   #7 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2010
Location: Issaquah, WA
Age: 41
Posts: 1,184
Default

Quote:
Originally Posted by Duncan C View Post
I agree with Dutch.

There are a lot of incredibly lazy people on these forums. They ask questions the answer to which are quite well documented, and make it clear they have spent zero time trying to figure out the answer for themselves.

I also hate it when people say "I want to write an app that does a, b, and c. Can you post example code that does that?"

It gets really old.
Quote:
Originally Posted by monty747 View Post
As long as I am going to be notified of the replies to a message I originally posted (and initially received a kind & helpful answer to) 8 MONTHS AGO, I feel the need to respond.

...

Second, your claim that my post asks for an entire app to be written from a line of code is absurd.

...
Whoa there! Duncan certainly didn't claim you asked for an app to be written. He just said that's ANOTHER thing he hates seeing. And I've seen it a lot... a WHOLE lot. It does get tiresome.

Not to criticize you, but it probably would have helped the situation if, back in November, you'd responded to this thread saying "thanks, that worked great!". I mean, when I've responded to threads and not gotten any feedback (which happens probably half the time, maybe more), it doesn't make me mad or anything, but it does make me wonder if the OP ever even read the reply, or ever visited the forum again at all.

Anyway, congrats on publishing your app! I'm sure you learned a lot in the process. Hopefully you'll be active in the forums and help out wherever you can. Also, would you care to share a link to the app, or the name of the app? Just curious; I always like to see what people on the board have out there.
__________________
Recall It! Tag your notes. Tag your photos. Tag your thoughts. Tag your life.

Recall It! for iPad

http://www.dljeffery.com
dljeffery is offline   Reply With Quote
Old 07-12-2010, 02:46 AM   #8 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 16
Default

Quote:
Originally Posted by dljeffery View Post
Whoa there! Duncan certainly didn't claim you asked for an app to be written. He just said that's ANOTHER thing he hates seeing. And I've seen it a lot... a WHOLE lot. It does get tiresome.

Not to criticize you, but it probably would have helped the situation if, back in November, you'd responded to this thread saying "thanks, that worked great!". I mean, when I've responded to threads and not gotten any feedback (which happens probably half the time, maybe more), it doesn't make me mad or anything, but it does make me wonder if the OP ever even read the reply, or ever visited the forum again at all.

Anyway, congrats on publishing your app! I'm sure you learned a lot in the process. Hopefully you'll be active in the forums and help out wherever you can. Also, would you care to share a link to the app, or the name of the app? Just curious; I always like to see what people on the board have out there.
You are right, I should have responded with a "thank you" here in the forum and will do in the future. I usually communicate a few more times directly (via email) with the people who have graciously taken their time to help me. I cannot remember if Akshay was one. Either way, I should do it here too.
monty747 is offline   Reply With Quote
Old 07-12-2010, 02:55 AM   #9 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 16
Default

Quote:
Originally Posted by Akshay Shah View Post
You need to set a complete frame of the imageView.
For the above values it will be done as
Code:
[myImageView setFrame:CGRectMake(myImageView.frame.origin.x, 
myImageView.frame.origin.y,10,20)];
Hope this helps...

Regards,
Akshay Shah.

I was reminded that I should have thanked you long ago for your help. If you are still able to receive this message, you should know that your snipped of code was exactly what I was looking for and could not find anywhere else. I did a search just now and still couldn't find it. Perhaps I'm looking in the wrong places but either way you solved my issue quickly. I hope there are many more people like you here in this forum who are willing to share bits of their expertise with those who may just be starting out.

I tried to download your app (in your signature) to give even more thanks and the App Store did locat it but gave an error when I tried to buy. Saying it was no longer available. I guess this will have to do. Thanks again.
monty747 is offline   Reply With Quote
Old 07-12-2010, 03:04 AM   #10 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2010
Location: Issaquah, WA
Age: 41
Posts: 1,184
Default

Quote:
Originally Posted by monty747 View Post
You are right, I should have responded with a "thank you" here in the forum and will do in the future. I usually communicate a few more times directly (via email) with the people who have graciously taken their time to help me. I cannot remember if Akshay was one. Either way, I should do it here too.
Honestly, I wasn't trying to jump down your throat about not posting an official "thanks" earlier.

But also, since you've gotten through your first app, I expect there are places around here you can now help out. Hope you will... that's the only thing that keeps the forum going!

And it would be cool if you added your app store link to your signature.
__________________
Recall It! Tag your notes. Tag your photos. Tag your thoughts. Tag your life.

Recall It! for iPad

http://www.dljeffery.com
dljeffery is offline   Reply With Quote
Old 07-12-2010, 07:59 AM   #11 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 4,795
Default

Quote:
Originally Posted by monty747 View Post
As long as I am going to be notified of the replies to a message I originally posted (and initially received a kind & helpful answer to) 8 MONTHS AGO, I feel the need to respond.

First of all, I apologize for the stupid question. With all the people willing to help (here, with web site tutorials and YouTube videos) I didn't think I needed to pass a basic skills test first before opening my mouth.

I did finish this app and it is available in the App Store. You might be interested to know that the answers to the questions I received was a very small percent of all the code I wrote over a period of a few months. Lazy you say? No. I had never written an application before. It's been a learning experience every day. I appreciate the help I received from those willing to give it.

Second, your claim that my post asks for an entire app to be written from a line of code is absurd. Nobody in here is asking for that. You make it sound like I copy & paste the answer to my question:
[myImageView setFrame:CGRectMake(myImageView.frame.origin.x,
myImageView.frame.origin.y,10,20)];
into xcode and hit Build&Go and I have a working app. Clearly impossibly!

Some of the people here are beginners (like me) who are asking for help with pieces of their code, not the entire thing. We are learning just like you did when you started out. If you want to help us, great. If not, please keep your replies to the posts you feel are worthy of your response.
Monty,

I apologize. I expressed a general frustration about lazy people in your thread, which had the effect of distilling that frustration and aiming it at you. It wasn't fair.

I'm glad to hear that you resolved your problem and went on to release an app to the store. Well done.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 07-24-2010, 12:25 PM   #12 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 2
Default this diidn't work for me

Quote:
Originally Posted by Dutch View Post
I really hate it when people ask questions that have answers that are SO easily findable by reading the most basic of apple's documentation... They register for a user account, they ask the question, make it OBVIOUS they are too lazy to read page one of anything, they get their answer and they are never heard from again.

Akshay, you are a better man than I - I would not have answered this absurdity.
i tried to implement this solution to make programmatic changes to the uiimageview dimensions, but failed. not sure y it didn't work. maybe we can get together to discuss it, i'll be in ny for a show next weekend. thanks!
jaygerr is offline   Reply With Quote
Old 07-24-2010, 12:31 PM   #13 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 2
Default this also didn't work for me

Quote:
Originally Posted by Duncan C View Post
I agree with Dutch.

There are a lot of incredibly lazy people on these forums. They ask questions the answer to which are quite well documented, and make it clear they have spent zero time trying to figure out the answer for themselves.

I also hate it when people say "I want to write an app that does a, b, and c. Can you post example code that does that?"

It gets really old.
hey, thanks for contributing to the thread, but unfortunately i couldn't make your solution work either, much the same as dutch's, so i've already asked for his assistance. i'm new to the game tho so it's to be expected i guess. anyways, it says on the left there that you're in NVA - i'm just outside of reston, so maybe you can explain further? i'm free everyday and can be there asap, i mean cuz i just can't figure out how to set these dimensions.
jaygerr is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 158,485
Threads: 89,094
Posts: 380,133
Top Poster: BrianSlick (7,091)
Welcome to our newest member, janice23
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:01 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0