I have a UITableViewCell
that contains a UIImageView'.
I need to display a 2nd
UIImageViewthat is centered on the 1st one.
(this 2nd UIImageView is not in the cell, but to be displayed on the screen coordinate system, so that it can be dragged outside of the
UITableViewthat has the
UITableViewCell`.
I can get the x,y
of the 1st UIImageView
, but this x,y
is relative to the cell.
How do I convert this x,y
to be relative to the screen, to be used to initially position the 2nd UIImageView
centered over the 1st?
I have tried: CGPoint screen_point = [device_icon_UIImageView convertPoint: device_icon_UIImageView.center toView:nil]; ...but screen_point is the relative x,y within the cell (615,85) and is not the x,y center of the device_icon_UIImageView in the screen (window) coordinate system (should be about 530,280).
THE CODE...................................
.h......................
@interface ataglance_central_controller : UIViewController
{
UIImageView* e_fairy_UIImageView;
}
@property (nonatomic,retain) UIImageView* e_fairy_UIImageView;
.m.............................................. @interface ataglance_central_controller () { } @end @synthesize e_fairy_UIImageView;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
THIS IS THE 1ST UIIMAGEVIEW, IN THE CELL:................ UIImageView* device_icon_UIImageView = (UIImageView*)[cell.contentView viewWithTag: BASE_UIIMAGEVIEW_TAG + ui++ ]; ...
self.e_fairy_UIImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed: @"E-fairy.png" ]];
self.e_fairy_UIImageView.center = screen_point;
[self.e_fairy_UIImageView setContentMode: UIViewContentModeScaleAspectFit]; [self.view addSubview: self.e_fairy_UIImageView];
...displays e_fairy_UIImageView
at bottom of screen, but cell's table is in upper half of screen.