2014-01-20 2 views
-1

UITableView cell이 있습니다. 그 시간을 선택한 검색 막대 목록에서 새 값을 추가하려고하면 그 값을 내가 테이블에 추가하고 같은 시간에 새로 추가 된 셀에 popover하지만 시간이 그것의 작동 완벽하지만 아무데도 표시 어디서나 내가 셀을 사용하고 있습니다 .frame 내 코드는 동일한 i에 어느 한 후 당신은 내가보기 엔 당신이 수정 제안 프로젝트의 펑키 코드를 많이 가지고 나에게 I expect like this image every timeUITableViewCell & bounds/frame 받기

- (void)loadPopOver:(id)idDataObj { 
    NSDictionary *dictDataObj = (NSDictionary*)idDataObj; 
    //add the popOverControl 

    OrdersDetailPopViewController *orderDetailPopVC = [[OrdersDetailPopViewController alloc] init]; 
    orderDetailPopVC.idParentDelegate = self; 

    CGSize sizeObj = [orderDetailPopVC initView:5 totalTextArea:0 dataForTableViews:[dictDataObj valueForKey:TAG_DATASOURCE] titles:[dictDataObj valueForKey:TAG_TITLES]]; 

    if (sizeObj.height == 0 && sizeObj.width == 0) { 
     NSLog(@"API Error : Incomplete data sent."); 
     return; 
    } 

    //Point from where to show the popOverControl 
    CGRect cgRect; 
    if (indexPathLastSelected.section == -1) { 

     if([_isFromSearchBar isEqualToString:@"FROM_SEARCH_BAR"]) 
     { 
      UITableViewCell *cell = [tableViewLeft cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]]; 
      cgRect = cell.frame; 
      //cgRect.origin.y = 190; 
      cgRect.origin.y = 25; 
      //cgRect.origin.x =270; 
     } 
     else if([_isFromRightTable isEqualToString:@"FROM_RIGHT_TABLE"]) 
     { 
      UITableViewCell *cell = [tableViewLeft cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]]; 
      cgRect = cell.frame; 
     } 
    } 
    else { 
     UITableViewCell *cell = [tableViewLeft cellForRowAtIndexPath:indexPathLastSelected]; 
     cgRect = cell.frame; 
    } 
    popOverFormInput = [[UIPopoverController alloc] initWithContentViewController:orderDetailPopVC]; 
    popOverFormInput.contentViewController = orderDetailPopVC; 
    [popOverFormInput setPopoverContentSize:sizeObj]; 
    popOverFormInput.delegate = self; 
    if (self.view.window != nil) 
    [popOverFormInput presentPopoverFromRect:cgRect inView:tableViewLeft permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; 

} 
+1

너는 하나의 긴 문장이다! 난 당신이 직면하는 문제를 이해하지 못합니다 : \ – Pavan

+0

안녕하세요 Pavan 문제는 그 때 내가 하나의 popover를 보여주는 tableview에 새로운 항목 양식 검색 표시 줄을 추가하지만 그것은 제대로 작동하지 않습니다 하나 contion 경우 ([_ isFromSearchBar isEqualToString : @ "FROM_SEARCH_BAR"])이 장면에서 나는 스크린 샷이 작동 할 때마다 popover를 보여줄 수는 없지만 아무런 작업이 없다. –

+0

예, 지금 당신이 말하는 것을 볼 수 있지만, 지금은 알 수 있습니다. 문제는 당신이 성취하고자하는 것이 무엇인가하는 것입니다. 왜냐하면 당신이 올바른 방법으로 그것을하지 않을 가능성이 있기 때문입니다; 코드 블록에서 펑키 코드를 볼 수 있습니다. 전반적인 목표를 달성 할 수 있도록 올바른 방법을 알려줄 수 있도록 전반적인 목표를 달성하기 위해 노력하고 있는지 알려주십시오. – Pavan

답변

0

난 그냥 지연 을 넣고 난 고정 문제 [자기 performSelector : @selector (showPopOver) withObject : nil afterDelay : 0.20];

0

도움 알고 예상 된 결과 화면 짧은도 기쁘게 첨부입니다 울부 짖는 소리입니다. 당신이 그렇지 않은 수도의 CGRect를 사용하여 팝업하기 위해 수퍼의 프레임을하려고 아니면 당신이 어딘가에 프레임 값의 오용되기 때문에 지금하지만, 나는이

//Get the cell's frame that you're interested in 
UITableViewCell *cell = [tableViewLeft cellForRowAtIndexPath:selectedindexPath] 

//and then use that cell's frame to position your popover over it. 
[popOverFormInput presentPopoverFromRect:[cell frame] inView:cell.contentView 
      permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 
0

같은 방법을 간단하게하기 위해가는 사용하는 것이 좋습니다하십시오.

tableview의 NSIndePath를보다 잘 얻으십시오 (참고). 나중에 예를 들어

> 그것에서 팝업하는 데 사용할 수 있습니다 : 메소드를 호출 당시

- (void)loadPopOver:(id)idDataObj { 
    NSIndexPath *selectedindexPath; 
    . 
    . 
    . 
    if([_isFromSearchBar isEqualToString:@"FROM_SEARCH_BAR"]) 
     selectedindexPath = // [tableViewLeft cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]]; 
    . 
    . 
    . 
    // Try this to pop your View 
    [self.popOver presentPopoverFromRect:[tableViewLeft rectForRowAtIndexPath:selectedindexPath] inView:[self view] permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];