当前位置: 代码迷 >> Iphone >> 两个UIVIEW之间的切换的有关问题?在线请问!
  详细解决方案

两个UIVIEW之间的切换的有关问题?在线请问!

热度:95   发布时间:2016-04-25 06:43:11.0
两个UIVIEW之间的切换的问题?在线请教!!!!!
testViewController是继承UIViewController,而下面的代码是继承在UIVIEW类里,而不是继承UIVIEWCONTRLLER.但是下面的代码一但执行到 [self presentModalViewController:_setViewController animated:YES];就会出错。请问怎么样才可以切换到另外一个UIVIEWController里。急着请教!!!!!!!

  testViewController *_setViewController = [[testViewController alloc]init];
  [self presentModalViewController:_setViewController animated:YES];
  [_setViewController release];
  [self dismissModalViewControllerAnimated:YES];

------解决方案--------------------
既然的的代码是在继承uiview的类中,当然就没有presentModalViewController方法啦

所以需要在你的view中加入一个delegate,将delegate指向你的viewcontroller(必须继承uiviewcontroller),然后[delegate presentModalViewController:_setViewController animated:YES];这样才可以
------解决方案--------------------
切换到另外一个UIVIEWController里 ?
你是想取到Controller的话 传值就可以了,简单的就是写个方法把指针附过去