4

Good day..! I would like to ask some assistance no how to accomplish this task in xcode?

here's the scenario.. I have several buttons.. example below..

enter image description here

--> Sample
--> Sample
--> Sample

When you clicked on the first sample1, it will display a text containing information.. when you clicked again sample1, it will return to its original position..

Example when clicked

--> Sample1
    --> Information here

--> Sample2
--> Sample3

when clicked again

--> Sample1
--> Sample2
--> Sample3

Hope to hear from you soon..

Thanks,

Link

Link
  • 531
  • 4
  • 10
  • 18
  • 2
    view.hidden = YES/NO; – mayuur Jan 02 '13 at 07:44
  • Xcode is an IDE. Please tag the question correctly. – trojanfoe Jan 02 '13 at 08:03
  • 1
    are you talking about Objective-c with Xcode ? also please! don't forget to add tag which is related to your question. – swiftBoy Jan 02 '13 at 08:43
  • Sorry about that.. I have made some adjustment.. – Link Jan 02 '13 at 08:45
  • 1
    1) If you have written any code to fulfill this requirement, then please post it here, we might be able to help 2) If you haven't done any code, then please do some effort on your side to implement this code, by reading some documentation, and come back here with any specific issue you face. Right now your question only describes your requirement, not what you have done, not a specific programming problem. Stackoverflow won't write code for you.. – Krishnabhadra Jan 02 '13 at 09:10

2 Answers2

27

You can set the hidden property as mayuur and iDhaval suggested

view.hidden = YES; // or
view.hidden = NO;

or by calling setHidden:

[view setHidden:YES]; // or
[view setHidden:NO];

You could also set the alpha property of the view to 0.0f, but know that it still receives touch events.

view.alpha = 0.0f; // or
[view setAlpha:0.0f];

See ColdLogic's answer to UIView hidden property...is there more to it? for code to animate the view "fading out," and Torsten Walter's answer to what's the difference between view's hidden = yes and alpha = 0.0f for more information on the difference between setting the alpha property of a view to 0.0f and setting its hidden property to YES, and how iOS handles it in different contexts. The relevant Apple documentation on UIView could prove helpful, too.

In case you want to animate the showing and hiding of those informational text views by moving them, it wouldn't be much of a stretch to modify the code at iDev Recipes for implementing side swiping on a table as in the Twitter app. The full source code is available on GitHub.

For more complex animation, reference Apple's Core Animation Programming Guide.

Since I'm new to the site and it's limiting the number of hyperlinks I can include, you'll have to copy and paste the URLs next to the bullets.

Community
  • 1
  • 1
yurrriq
  • 641
  • 7
  • 12
  • Thanks for sharing this information.. I have added a screenshot.. New to ios development that's why 'm asking if this is possible.. – Link Jan 02 '13 at 12:09
1

Please use the hidden property with respective view on click event of button.

iDhaval
  • 7,824
  • 2
  • 21
  • 30