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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 08-23-2011, 02:41 PM   #1 (permalink)
Jez
Registered Member
 
Join Date: Aug 2011
Posts: 10
Jez is on a distinguished road
Default With UIButton in UIView to UIView controller

Hi Guys,

I am almost done with my first app but this stupid little thing bothers me at last.
I cant figure out how it will work.

In my first UIViewController i set a UIView on loadView:

[self setView:myView]

Now I have a button in myView which shall redirect to a new ViewController.
From Controller to controller I just use
[self presentModalViewControllar:....]
But of course that doesnt work from within myView.

I tried a couple of things but I cant make it run.
Which is the easiest way to implement this?

Cheers
Jez is offline   Reply With Quote
Old 08-23-2011, 10:38 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

You could create a delegate property in the view.

You could use notifications.

You could ditch the code-based stuff altogether and just use IB.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 08-24-2011, 05:15 PM   #3 (permalink)
Jez
Registered Member
 
Join Date: Aug 2011
Posts: 10
Jez is on a distinguished road
Default

Okay.
I tried it to do it with Notifications but I cant figure out the right way.
I am also getting confused with all the different Notification types.
If I have a method in my ViewController with name View5id)sender
how can I then call it from a Subview? Like this?
Code:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(View5:) name:nil object:nil];
But it is not working. Is there a good tutorial to show how Notifications work?
Thanks
Jez is offline   Reply With Quote
Old 08-28-2011, 02:22 PM   #4 (permalink)
Jez
Registered Member
 
Join Date: Aug 2011
Posts: 10
Jez is on a distinguished road
Default

Alright then. It is working now with Notifications. Nice thing!

Anyway now I am having a related problem.

I want to change a uiviews integer variable from a uiviewcontroller. But the UIview is not the View of that Viewcontroller.

Is there also a way to do it with notifications? Or I have to switch to delegates?

Thanks
Jez 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
» Online Users: 398
15 members and 383 guests
7twenty7, chiataytuday, cristofercolmbos, dedeys78, fiftysixty, gmarro, iOS.Lover, jonathandeknudt, kilobytedump, Matrix23, raymng, stanny, tymex, UMAD, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

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