Я предполагаю, что этот код является частью из вас GSAActivityViewController
класс. При этом вам не нужно создавать новый GSAActivityViewController
и менять метку на этом контроллере, потому что у вас уже есть инициализированный контроллер.
Вот что делает ваш код:
//This line is getting your IPADAG1Activity correctly it looks like, this is fine
IPADAG1Activity *activite = [[objects objectForKey:[objectsIndex objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
//This code is creating a brand new UIView called *contentView, but it never gets used. I am guessing that you are getting a warning about an unused variable here. ? This line does not need to be in the program as far as I can tell because you don't need to create a new contentView, you just need to use the on GSAActivityViewController
UIView *contentView = [[UIView alloc]init ];
//The line below is creating a brand new instance of GSAActivityViewController, but you don't want a brand new isntance, you want to use this GSAActivityViewController that has already been initialized. This line does not need to be in the program as fas as I can tell.
//now I instanciate my UIViewController wich contain : uiview *contentview and uitableview
GSAActivityViewController *activity = [[GSAActivityViewController alloc]init];
//Lastly, you are changing the text of desc on the new GSAActivityViewController that you created. This controller did not need to be created and is not being used in any way other than this function block, so when you change the text on desc you are changing the text on something that has not been displayed and is just about to get tossed out when this function ends (Assuming ARC)
//in uiview I add label "desc" that I affect the value of activite.DESCRIPTION
activity.desc.text = activite.DESCRIPTION;
Так, чтобы исправить вашу проблему, вы можете просто использовать self
для получения текущего GSAActivityViewController
. Вам не нужно инициализировать новый (или новый contentView
).
Так вот как ваш код должен выглядеть:
IPADAG1Activity *activite = [[objects objectForKey:[objectsIndex objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
//in uiview I add label "desc" that I affect the value of activite.DESCRIPTION
self.desc.text = activite.DESCRIPTION;
Этот ответ основан на нескольких допущениях, в первую очередь, что desc
является этикетка, которая является собственностью GSAActivityViewController
и что этот код находится внутри GSAActivityViewController
,
Вы пытаетесь создать новый viewController и добавить его в строку tableView или пытаетесь получить доступ к viewController на другом представлении? –
Кажется, вам нужно просто добавить новый вид viewController, а не создать новый viewController для хранения представления. –
@MarkM: Я не понимаю, что вы подразумеваете под этим –