2016-06-29 3 views
0

버튼을 삭제하기로 결정 했으므로 이제 탐색하고 싶습니다. 아이디어는 간단합니다. '다음 사이트'를 클릭하면 응용 프로그램의 다른 사이트로 전송됩니다. 그러나 나는 이것을 어떻게하는지 모른다.사용자 인터페이스로 어떻게 이동합니까?

코드 :

using System; 
using System.Collections.Generic; 
using System.Text; 
using Foundation; 
using UIKit; 

namespace TableView 
{ 
public class TableSource : UITableViewSource 
{ 
    string[] tableItems; 
    string cellIdentifier = "TableCell"; 



    public TableSource (string[] items) 
    { 
     tableItems = items; 
    } 

    public override nint RowsInSection(UITableView tableview, nint section) 
    { 
     return tableItems.Length; 
    } 
    public override void RowSelected(UITableView tableView, NSIndexPath indexPath) 
    { 
     new UIAlertView("Alert", "You selected: " + tableItems[indexPath.Row], null, "Next Site", null).Show(); 
     tableView.DeselectRow(indexPath, true); 
    } 
    public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) 
    { 
     UITableViewCell cell = tableView.DequeueReusableCell(cellIdentifier); 
     if (cell == null) 
      cell = new UITableViewCell(UITableViewCellStyle.Subtitle, cellIdentifier); 
     cell.TextLabel.Text = tableItems[indexPath.Row]; 

     if(indexPath.Row > -1) 
      cell.DetailTextLabel.Text = tableItems[indexPath.Row - 0]; 



      return cell; 
    } 
} 
} 
+0

질문이 너무 애매하거나 심하게 쓰면 그것을 삭제하거나 편집 할 수 있습니다. – AnonymUser

+0

'UIAlertView'는 iOS8 +에서 더 이상 사용되지 않습니다. 대신'UIAlertController'를 다루어야합니다. – holex

+0

다음을 참조하십시오 : https://iosdevcenters.blogspot.com/2016/03/uialertcontroller-in-swift.html에서 원하는대로 탐색 버튼을 클릭하십시오. –

답변

0

UIAlertView 아이폰 OS 8 이후 depricated하고 UIAlertController로 교체해야합니다. UIAlertController의 경우 작업을 제공 할 수 있습니다.

var alert = UIAlertController.Create("Title", "Message", UIAlertControllerStyle.Alert); 
alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, ActionHandler)); 

내 ActionHandler 안에 새 페이지로 전환 할 수 있습니다.

관련 문제