我确信这是一个完全愚蠢的问题。我有一个viewController,它位于TabBarController内的导航控制器内。 Apple表示这是实现该设置的正确方法。但是,我如何为该复合体准备ForSeque并将数据发送到第一个ViewController。
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "presentActionItems" {
println("preparing")
let tabBarController:actionItemsTabController = segue.destinationViewController as! actionItemsTabController
let navigationController = ???
let viewController = ???
viewController.givenURL = actionItemsURL
}
}
我相信这是一个简单的问题,我可以帮忙吗?
答案 0 :(得分:1)
在传递数据后,在TabController的viewDidLoad中尝试此操作
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main (){
std::vector< int > interrogation ;
std::vector< int > dot;
string look = "?";
string look_again = ".";
string test = "ver. o que e isto? nao sei. ola? adeus. fghfghfhfghf";
string::size_type pos = test.find(look);
string::size_type sop = test.find(look_again);
string::size_type exc = test.find(look_again_again);
while (pos != std::string::npos)
{
int a = pos ;
int b = sop;
cout << " . found at : " << sop << std::endl;
cout << " ? found at : " << pos << std::endl;
interrogation.push_back(a);
dot.push_back(b);
string fragment = test.substr (0 , pos ); // works
//cout << fragment << endl ;
string fragment2 = test.substr (0 , sop ); // works
//cout << fragment2 << endl ;
pos = test.find(look, pos + 1);
sop = test.find(look_again, sop + 1);
}
int x = 1;
if(x > 0){
int a = 1;
int q = dot[a];
int w = interrogation[a];
// to save text
// to save text
string save = "saved_question.txt" ;
ofstream myfile;
myfile.open (save.c_str(), ios::app);
myfile << test.substr( 18, 20 ) + "\n" ;
myfile.close();
cout << "Question saved in text file" << endl;
}
}