Search Results

Search found 641 results on 26 pages for 'imageview'.

Page 8/26 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • App is getting run in iOS 5.1.1 but crashed in iOS 6.1.3

    - by Jekil Patel
    I have implemented below code but app has been crashed in iPad with iOS version 6.1.3,while running perfectly in iPad with iOS version 5.1.1. when I am scrolling table view continuously it is crashed in ios version 6.1.3. what could be the issue. The implemented delegate and data source methods for the table view are as given below. #pragma mark - Table view data source -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [UserList count]; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 70; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; //cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell = nil; if (cell == nil) { // cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } UIImageView *imgViweback; imgViweback = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,0,0)]; imgViweback.image = [UIImage imageNamed:@"1scr-Student List Tab BG.png"]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 10, 32, 32)]; UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(12, 5, 50, 50)]; UILabel *lblName = [[UILabel alloc] initWithFrame:CGRectMake(110, 5, 200, 40)]; //cell.backgroundColor = [UIColor clearColor]; //cell.alpha = 0.5f; CountSelected = 0; flagQuizEnabled = NO; if ([[[checkedImages objectAtIndex:indexPath.row] valueForKey:@"checked"] isEqualToString:@"NO"]) { // cell.imageView.image = [UIImage imageNamed:@"Unchecked.png"]; //imageView.image = [UIImage imageNamed:@"Unchecked.png"]; } else { //imageView.image = [UIImage imageNamed:@"Checked.png"]; } NSString *pathTillApp=[[self getImagePath] stringByDeletingLastPathComponent]; NSLog(@"Path Till App %@",pathTillApp); NSString *makePath=[NSString stringWithFormat:@"%@%@",pathTillApp,[[UserList objectAtIndex:indexPath.row ]valueForKey:@"ImagePath"]]; NSLog(@"makepath=%@",makePath); imageView1.image = [UIImage imageWithContentsOfFile:makePath]; [cell.contentView insertSubview:imgViweback atIndex:0]; [cell.contentView insertSubview:imageView atIndex:0]; [cell.contentView insertSubview:imageView1 atIndex:2]; lblName.text =[NSString stringWithFormat:@"%@ %@",[[UserList objectAtIndex:indexPath.row] valueForKey:@"FirstName"],[[UserList objectAtIndex:indexPath.row] valueForKey:@"LastName"]]; lblName.backgroundColor = [UIColor clearColor]; lblName.font = [UIFont boldSystemFontOfSize:22.0f]; //lblName.font = [UIFont fontWithName:@"HelveticaNeue Heavy" size:22.0f]; lblName.font = [UIFont fontWithName:@"Chalkboard SE" size:22.0f]; [cell.contentView insertSubview:lblName atIndex:3]; [imgViweback release]; [imageView release]; [imageView1 release]; [lblName release]; imgViweback = nil; imageView = nil; imageView1 = nil; lblName = nil; //cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; return cell; } #pragma mark - Table view delegate -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"Values : %@", Val); }

    Read the article

  • Center content of UISCrollView when smaller

    - by hgpc
    I have an UIImageView inside a UIScrollView which I use for zooming and scrolling. If the image/content of the scroll view if bigger than the scroll view everything works fine. However, when the image becomes smaller than the scroll view, it sticks to the top left corner of the scroll view. I would like to keep it centered, like the Photos app. Any ideas or examples about keeping the content of the UIScrollView centered when smaller? I am working with iPhone 3.0. The following code almost works. The image returns to the top left corner if I pinch it after reaching the minimum zoom level. - (void)loadView { [super loadView]; // set up main scroll view imageScrollView = [[UIScrollView alloc] initWithFrame:[[self view] bounds]]; [imageScrollView setBackgroundColor:[UIColor blackColor]]; [imageScrollView setDelegate:self]; [imageScrollView setBouncesZoom:YES]; [[self view] addSubview:imageScrollView]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"WeCanDoIt.png"]]; [imageView setTag:ZOOM_VIEW_TAG]; [imageScrollView setContentSize:[imageView frame].size]; [imageScrollView addSubview:imageView]; CGSize imageSize = imageView.image.size; [imageView release]; CGSize maxSize = imageScrollView.frame.size; CGFloat widthRatio = maxSize.width / imageSize.width; CGFloat heightRatio = maxSize.height / imageSize.height; CGFloat initialZoom = (widthRatio heightRatio) ? heightRatio : widthRatio; [imageScrollView setMinimumZoomScale:initialZoom]; [imageScrollView setZoomScale:1]; float topInset = (maxSize.height - imageSize.height) / 2.0; float sideInset = (maxSize.width - imageSize.width) / 2.0; if (topInset < 0.0) topInset = 0.0; if (sideInset < 0.0) sideInset = 0.0; [imageScrollView setContentInset:UIEdgeInsetsMake(topInset, sideInset, -topInset, -sideInset)]; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return [imageScrollView viewWithTag:ZOOM_VIEW_TAG]; } /************************************** NOTE **************************************/ /* The following delegate method works around a known bug in zoomToRect:animated: */ /* In the next release after 3.0 this workaround will no longer be necessary */ /**********************************************************************************/ - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale { [scrollView setZoomScale:scale+0.01 animated:NO]; [scrollView setZoomScale:scale animated:NO]; // END Bug workaround CGSize maxSize = imageScrollView.frame.size; CGSize viewSize = view.frame.size; float topInset = (maxSize.height - viewSize.height) / 2.0; float sideInset = (maxSize.width - viewSize.width) / 2.0; if (topInset < 0.0) topInset = 0.0; if (sideInset < 0.0) sideInset = 0.0; [imageScrollView setContentInset:UIEdgeInsetsMake(topInset, sideInset, -topInset, -sideInset)]; }

    Read the article

  • android customize gallery focus problem

    - by Faisal khan
    Gallery With reference to the following link http://www.anddev.org/novice-tutorials-f8/a-android-widget-gallery-example-t332-60.html In above link they are actually animating selected item of the gallery but i want to change the picture when it is selected, for that i am having following code. Problem is when i use roller ball to scroll gallery from left to right or right to left to right after scroll on image focus automatically shift to next widget. public class SizingGallery extends Gallery{ public SizingGallery(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected boolean getChildStaticTransformation(View child, Transformation t) { t.clear(); ImageView selectedChild = (ImageView) getSelectedView(); ImageView iv = (ImageView) child; BrowseMapCategoryRow cr = (BrowseMapCategoryRow) iv.getTag(); //Following line change the image resource that causing defocus gallery iv.setImageResource((iv == selectedChild)?cr.getSelectedImgSrc():cr.getUnSelectedImgSrc()); return true; } }

    Read the article

  • TTImageView not working

    - by Ajay Sawant
    Guys, I am new to IPhone and using following code to render the image from remote server using TTImageView from Three20 framework with the help of following code TTImageView* imageView = [[[TTImageView alloc] initWithFrame:CGRectMake(30, 30, 0, 0)] autorelease]; //Working OK //imageView.urlPath = @"http://prosares.co.cc/Images/background.jpg"; //No Working imageView.urlPath = @"http://prosares.co.cc/Images/backgroundTest.jpg"; [self.view addSubview:imageView]; As shown above if I am trying to load background.jpg it's getting loaded correctly but for some reason backgroundTest.jpg is not loading at all. the only diffrance in these images are the size, is there any restriction on the image size that I can load in TTImageView ? Can someone please help me to debug this issue? Thanks Ajay Sawant

    Read the article

  • Android setImageURI out of memory error

    - by Improver
    I have a very small activity that must show an image. If picture is not very small (for example 1.12 Mb 2560x1920) it produces out of memory on change screen orientation. I tried getDrawable.setCallback(null) but no luck. Where am I wrong? public class Fullscreen extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); System.gc(); setContentView(R.layout.fullscreen); ImageView imageView = (ImageView) findViewById(R.id.full_screen_image); long imageId = 2; imageView.setImageURI(Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + imageId)); } }

    Read the article

  • Implementing a customized drawable in Android

    - by Girish
    Hi , I was trying to get hold of 2D graphics in Android. As a example i want to implement a custom drawable and show it in my Activity I have defined a customized drawable by extending from Android drawable as mentioned below myDrawable extends Drawable { private static final String TAG = myDrawable.class.getSimpleName(); private ColorFilter cf; @Override public void draw(Canvas canvas) { //First you define a colour for the outline of your rectangle Paint rectanglePaint = new Paint(); rectanglePaint.setARGB(255, 255, 0, 0); rectanglePaint.setStrokeWidth(2); rectanglePaint.setStyle(Style.FILL); //Then create yourself a Rectangle RectF rectangle = new RectF(15.0f, 50.0f, 55.0f, 75.0f); //in pixels Log.d(TAG,"On Draw method"); // TODO Auto-generated method stub Paint paintHandl = new Paint(); // paintHandl.setColor(0xaabbcc); paintHandl.setARGB(125, 234, 213, 34 ); RectF rectObj = new RectF(5,5,25,25); canvas.drawRoundRect(rectangle, 0.5f, 0.5f, rectanglePaint); } @Override public int getOpacity() { // TODO Auto-generated method stub return 100; } @Override public void setAlpha(int alpha) { // TODO Auto-generated method stub } @Override public void setColorFilter(ColorFilter cf) { // TODO Auto-generated method stub this.cf = cf; } } I am trying to get this displayed in my activity, as shown below public class custDrawable extends Activity { /** Called when the activity is first created. */ LinearLayout layObj = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); layObj = (LinearLayout) findViewById(R.id.parentLay); ImageView imageView = (ImageView) findViewById(R.id.icon2); myDrawable myDrawObj = new myDrawable(); imageView.setImageDrawable(myDrawObj); imageView.invalidate(); // layObj.addView(myDrawObj, params); } } But when i run the app i see no rectangle on the activity, can anyone help me out? Where am i going wrong?

    Read the article

  • Part of my layout goes upward with keyboard

    - by Burak Dede
    My android app have a layout like this when i open keyboard two imageview at the bottom of the page shows up over the keyboard , i couldnt see the problem why it goes upward with the keyboard can you help me about this ? <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:id="@+id/searchLinear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/upperbackground"> <EditText android:id="@+id/searchBox" android:layout_alignParentTop="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:layout_margin="12dip" android:paddingLeft="35dip" android:textSize="15sp" android:background="@drawable/search_bar"/> </LinearLayout> <LinearLayout android:id="@+id/searchButtons" android:layout_below="@id/searchLinear" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_vertical|center_horizontal" android:background="@color/upperbackground"> <ImageView android:id="@+id/btnSukela" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:focusable="true" android:onClick="sukelaClickEvent" android:paddingRight="8dip" android:paddingBottom="5dip" android:src="@drawable/sukela"/> <ImageView android:id="@+id/btnSearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/btnSukela" android:clickable="true" android:focusable="true" android:onClick="searchEntryClickEvent" android:paddingLeft="8dip" android:paddingBottom="5dip" android:src="@drawable/search"/> </LinearLayout> <RelativeLayout android:id="@+id/bottomLinear" android:layout_alignParentBottom="true" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_vertical|center_horizontal" android:background="@drawable/bottom_back"> <ImageView android:id="@+id/btnToday" android:src="@drawable/today" android:background="@color/bottombackground" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/bottomLinear" android:layout_marginBottom="19dip" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" android:onClick="todayClickEvent"/> <ImageView android:id="@+id/btnPopular" android:src="@drawable/popular" android:background="@color/bottombackground" android:layout_toRightOf="@+id/btnToday" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" android:onClick="popularClickEvent"/> </RelativeLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/searchButtons" android:layout_above="@+id/bottomLinear" android:background="@color/background"> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </RelativeLayout> </RelativeLayout>

    Read the article

  • Creating a UIImage from a rotated UIImageView...

    - by Magic Bullet Dave
    I have a UIImageView with an image in it. I have rotated the image prior to display by setting the transform property of the UIImageView to CGAffineTransformMakeRotation(angle) where angle is the angle in radians. I want to be able to create another UIImage that corresponds to the rotated version that I can see in my view. I am almost there, by rotating the image context I get a rotated image: - (UIImage *) rotatedImageFromImageView: (UIImageView *) imageView { UIImage *rotatedImage; // Get image width, height of the bonuding rectangle CGRect boundingRect = [self getBoundingRectAfterRotation: imageView.bounds byAngle:angle]; // Create a graphics context the size of the boundinf rectangle UIGraphicsBeginImageContext(boundingRect.size); CGContextRef context = UIGraphicsGetCurrentContext(); // Rotate and translate the context CGAffineTransform ourTransform = CGAffineTransformIdentity; ourTransform = CGAffineTransformConcat(ourTransform, CGAffineTransformMakeRotation(angle)); CGContextConcatCTM(context, ourTransform); // Draw the image into the context CGContextDrawImage(context, CGRectMake(0, 0, imageView.image.size.width, imageView.image.size.height), imageView.image.CGImage); // Get an image from the context rotatedImage = [UIImage imageWithCGImage: CGBitmapContextCreateImage(context)]; // Clean up UIGraphicsEndImageContext(); return rotatedImage; } However the image is not rotated about its centre. I have tried all kinds of transforms concatenated with my rotate to get it to rotate around the centre but to no avail. Am I missing a trick? Is this even possible since I am rotating the context not the image? Getting desperate to make this work now, so any help would be appreciated. Dave

    Read the article

  • How to crop Image in iPhone?

    - by aman-gupta
    Hi, In my application I m using following codes to crop the captured image :- -(void)imagePickerController:(UIImagePickerController *) picker didFinishPickingMediaWithInfo:(NSDictionary *)info { #ifdef _DEBUG NSLog(@"frmSkinImage-imagePickerController-Start"); #endif imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; //======================================= UIImage *image =imageView.image; CGRect cropRect = CGRectMake(100, 100, 125,128); CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], cropRect); [imageView setImage:[UIImage imageWithCGImage:imageRef]]; CGImageRelease(imageRef); //=================================================== //imgglobal = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; // for saving image to photo album //UIImageWriteToSavedPhotosAlbum(imageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), self); [picker dismissModalViewControllerAnimated:YES]; #ifdef _DEBUG NSLog(@"frmSkinImage-imagePickerController-End"); #endif } But my problem is that when I use camera to take photo to crop the captured image it rotates the image to 90 degree towards right and in case I use Photo library it works perfectly. So Can u filter my above codes to know where I m wrong. Please help me out its urgent Thanks In Advance

    Read the article

  • How can i make a gallery with web images from my website?

    - by ronhdoge
    I currently have two codes that i am trying to figure out how to mix or write a new code to have a gallery with image doing fill_parent but i can slide sideways to see the other url linked images from my site. here are both parts of code i have: package com.mandarich.gallerygrid; import java.io.InputStream; import java.net.URL; import android.app.Activity; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.widget.ImageView; public class Gallery extends Activity { /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView imgView =(ImageView)findViewById(R.id.ImageView01); Drawable drawable = LoadImageFromWebOperations("http://www.mandarichmodels.com/hot-pics/"); imgView.setImageDrawable(drawable); } private Drawable LoadImageFromWebOperations(String url) { try { InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; }catch (Exception e) { System.out.println("Exc="+e); return null; } } } and here is my gallery code package com.mandarich.Grid; import android.app.Activity; import android.content.Context; import android.content.res.TypedArray; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.ImageView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; public class gridfinal extends Activity { private Gallery gallery; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); gallery = (Gallery) findViewById(R.id.examplegallery); gallery.setAdapter(new AddImgAdp(this)); gallery.setOnItemClickListener(new OnItemClickListener() { @SuppressWarnings("unchecked") public void onItemClick(AdapterView parent, View v, int position, long id) { // Displaying the position when the gallery item in clicked Toast.makeText(gridfinal.this, "Position=" + position, Toast.LENGTH_SHORT).show(); } }); } public class AddImgAdp extends BaseAdapter { int GalItemBg; private Context cont; // Adding images. private Integer[] Imgid = { R.drawable.cindy, R.drawable.clinton, R.drawable.colin, R.drawable.cybil, R.drawable.david, R.drawable.demi, R.drawable.drew }; public AddImgAdp(Context c) { cont = c; TypedArray typArray = obtainStyledAttributes(R.styleable.GalleryTheme); GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0); typArray.recycle(); } public int getCount() { return Imgid.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ImageView imgView = new ImageView(cont); imgView.setImageResource(Imgid[position]); // Fixing width & height for image to display imgView.setLayoutParams(new Gallery.LayoutParams(430, 370)); imgView.setScaleType(ImageView.ScaleType.FIT_XY); imgView.setBackgroundResource(GalItemBg); return imgView; } } }

    Read the article

  • getView() (for a Custom ListView ) doesn't get called on notifyDatasetChanged()

    - by hungson175
    Hi everyone, I have the following problem, and searched for a while but haven't got any solution from the net: I have a custom list view, each item has the following layout (I just post the essential): <LinearLayout> <ImageView android:id="@+id/friendlist_iv_avatar" /> <TextView andorid:id="@+id/friendlist_tv_nick_name" /> <ImageView android:id="@+id/friendlist_iv_status_icon" /> </LinearLayout> And I have a class FriendRowItem, which is inflated from the above layout: public class FriendRowItem extends LinearLayout{ private ImageView ivAvatar; private ImageView ivStatusIcon; private TextView tvNickName; public FriendRowItem(Context context) { super(context); RelativeLayout friendRow = (RelativeLayout) Helpers.inflate(context, R.layout.friendlist_row); this.addView(friendRow); ivAvatar = (ImageView)findViewById(R.id.friendlist_iv_avatar); ivStatusIcon = (ImageView)findViewById(R.id.friendlist_iv_status_icon); tvNickName = (TextView)findViewById(R.id.friendlist_tv_nick_name); } public void setPropeties(Friend friend) { //Avatar ivAvatar.setImageResource(friend.getAvatar().getDrawableResourceId()); //Status Status.Type status = friend.getStatusType(); if ( status == Type.ONLINE) { ivStatusIcon.setImageResource(R.drawable.online_icon); } else { ivStatusIcon.setImageResource(R.drawable.offline_icon); } //Nickname String name = friend.getChatID(); if ( friend.hasName()) { name = friend.getName(); } tvNickName.setText(name); } } In the main activity, I have a custom listview: lvMainListView, with an custom adapter (whose class extends ArrayAdapter - and off course: override the method getView ), the data set of the adapter is: ArrayList<Friend> friends: private class FriendRowAdapter extends ArrayAdapter<Friend> { public FriendRowAdapter(Context applicationContext, int friendlistRow, ArrayList<Friend> friends) { super(applicationContext, friendlistRow, friends); } @Override public View getView(int position,View convertView,ViewGroup parent) { Friend friend = getItem(position); FriendRowItem row = (FriendRowItem) convertView; if ( row == null ) { row = new FriendRowItem(ShowFriendsList.this.getApplicationContext()); } row.setPropeties( friend ); return row; } } the problem is when I change the status of a friend from OFFLINE to ONLINE, then call notifyDataSetChanged(), nothing happens : the status icon of that friend doesn't change. I tried debugging, and saw the code: notifyDataSetChanged() get called, but the custom getView() is not fired ! Can you please tell me, that is normal in Android, or did I do something wrong ? (I am using Android 1.5). Thank you in advance, Son

    Read the article

  • How do I center a UIImageView within a full-screen UIScrollView?

    - by Sebastian Celis
    In my application, I would like to present the user with a full-screen photo viewer much like the one used in the Photos app. This is just for a single photo and as such should be quite simple. I just want the user to be able to view this one photo with the ability to zoom and pan. I have most of it working. And, if I do not center my UIImageView, everything behaves perfectly. However, I really want the UIImageView to be centered on the screen when the image is sufficiently zoomed out. I do not want it stuck to the top-left corner of the scroll view. Once I attempt to center this view, my vertical scrollable area appears to be greater than it should be. As such, once I zoom in a little, I am able to scroll about 100 pixels past the top of the image. What am I doing wrong? @interface MyPhotoViewController : UIViewController <UIScrollViewDelegate> { UIImage* photo; UIImageView *imageView; } - (id)initWithPhoto:(UIImage *)aPhoto; @end @implementation MyPhotoViewController - (id)initWithPhoto:(UIImage *)aPhoto { if (self = [super init]) { photo = [aPhoto retain]; // Some 3.0 SDK code here to ensure this view has a full-screen // layout. } return self; } - (void)dealloc { [photo release]; [imageView release]; [super dealloc]; } - (void)loadView { // Set the main view of this UIViewController to be a UIScrollView. UIScrollView *scrollView = [[UIScrollView alloc] init]; [self setView:scrollView]; [scrollView release]; } - (void)viewDidLoad { [super viewDidLoad]; // Initialize the scroll view. CGSize photoSize = [photo size]; UIScrollView *scrollView = (UIScrollView *)[self view]; [scrollView setDelegate:self]; [scrollView setBackgroundColor:[UIColor blackColor]]; // Create the image view. We push the origin to (0, -44) to ensure // that this view displays behind the navigation bar. imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, -44.0, photoSize.width, photoSize.height)]; [imageView setImage:photo]; [scrollView addSubview:imageView]; // Configure zooming. CGSize screenSize = [[UIScreen mainScreen] bounds].size; CGFloat widthRatio = screenSize.width / photoSize.width; CGFloat heightRatio = screenSize.height / photoSize.height; CGFloat initialZoom = (widthRatio > heightRatio) ? heightRatio : widthRatio; [scrollView setMaximumZoomScale:3.0]; [scrollView setMinimumZoomScale:initialZoom]; [scrollView setZoomScale:initialZoom]; [scrollView setBouncesZoom:YES]; [scrollView setContentSize:CGSizeMake(photoSize.width * initialZoom, photoSize.height * initialZoom)]; // Center the photo. Again we push the center point up by 44 pixels // to account for the translucent navigation bar. CGPoint scrollCenter = [scrollView center]; [imageView setCenter:CGPointMake(scrollCenter.x, scrollCenter.y - 44.0)]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[[self navigationController] navigationBar] setBarStyle:UIBarStyleBlackTranslucent]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[[self navigationController] navigationBar] setBarStyle:UIBarStyleDefault]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES]; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return imageView; } @end

    Read the article

  • android circulate gallery iteration with 10 items.

    - by Faisal khan
    I am using the following customize gallery. I am having static 10 images, i want circulatery gallery which should circlate always should never ends after last item it should auto start by 1 or after first it should auto start from end. public class SizingGallery extends Gallery{ public SizingGallery(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected boolean getChildStaticTransformation(View child, Transformation t) { t.clear(); ImageView selectedChild = (ImageView)getSelectedView(); ImageView iv =(ImageView)child; BrowseMapCategoryRow cr = (BrowseMapCategoryRow)iv.getTag(); if (iv == selectedChild) { selectedChild.setImageResource(cr.getSelectedImgSrc()); }else{ iv.setImageResource(cr.getUnSelectedImgSrc()); } return true; } @Override protected int getChildDrawingOrder(int childCount, int i) { return super.getChildDrawingOrder(childCount, i); } }

    Read the article

  • Scrolling png with text & alpha on top of a static UIImageView

    - by heymon
    I have a view controller that has a view structure as follows: FilesOwner FirstResponder View ImageView (.jpg) ScrollView ImageView (.png) The text in the innermost imageview has white text and clear (alpha) all around. I want to scroll the innermost imageview, and see the background image (the .jpg) behind it. Its not working. Its acting like the scrollview background obscures the underneath .jpg. I say this because if I change the background color of the scrollview, that's what I see i.e. if I set it black, I see black behind my .png, if I set it white, I see white. If I change the alpha of the scrollview that doesn't seem to work either. The one other thing I tried was unchecking drawing: Opaque, but that doesn't get it either.

    Read the article

  • Gallery items become off-center when switching into landscape orientation.

    - by Sandile
    Hey Guys, Thanks for your time. I'm writing an application for android 2.2 and I'm using a gallery to circulate through a list of images that the user can then click to navigate other portions of the application. In portrait orientation, everything is kosher: the images are displaying correctly (completely in the center of the screen as I intended); however, in landscape orientation, all the images in the gallery are strangely displaced a fixed distance to the left of the center of the screen. I've been researching this issue for hours now and haven't found a solution. I'm hoping that some android guru can aid me in the resolution of this bizarre rendering issue. MainMenuActivity.java relevant code snippet (the activity in which the gallery resides) Gallery optionList = (Gallery)findViewById(R.id.mainMenuOptionList); GalleryItem[] optionListItemIdArray = new GalleryItem[] { new GalleryItem(R.drawable.icon_main_menu_option_list_blackboard, "Start Next Lesson", "Start the next planned vocab lesson."), new GalleryItem(R.drawable.icon_main_menu_option_list_index_cards, "Review Words", "Manually look over old words."), new GalleryItem(R.drawable.icon_main_menu_option_list_dice, "Play Vocab Games", "Play games to reinforce knowledge."), new GalleryItem(R.drawable.icon_main_menu_option_list_calendar, "View Lesson Plan", "View the schedule for coming lessons."), new GalleryItem(R.drawable.icon_main_menu_option_list_pie_chart, "View Performance Report", "Evaluate your overall performance statistics."), new GalleryItem(R.drawable.icon_main_menu_option_list_settings, "Manage Settings", "Change and modify application settings.") }; optionList.setAdapter(new GalleryImageAdapter(this, optionListItemIdArray)); NOTE: A GalleryItem is a POJO with an image resource id, title and description. GalleryImageAdapter.java: public class GalleryImageAdapter extends BaseAdapter { private Context context; private GalleryItem[] galleryItemArray; public GalleryImageAdapter(Context context, GalleryItem[] galleryItemArray) { this.context = context; this.galleryItemArray = galleryItemArray; } @Override public int getCount() { return galleryItemArray.length; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(context); imageView.setImageResource(galleryItemArray[position].getImageId()); imageView.setScaleType(ImageView.ScaleType.FIT_START); imageView.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.WRAP_CONTENT, Gallery.LayoutParams.WRAP_CONTENT)); return imageView; } } Portrait version of main_menu.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuLinearLayout" android:background="#3067a8" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="10dip" android:textColor="#ffffff" android:textSize="50sp" android:text="@string/main_menu_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuSubHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="15dip" android:textColor="#ffffff" android:textSize="15sp" android:text="@string/main_menu_sub_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionList" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="20dip" android:paddingBottom="10dip" android:spacing="40dip" /> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionListDetailLinearLayout" android:gravity="center_vertical|center_horizontal" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuOptionListLabelTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="25sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuOptionListDescriptionTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="15sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> </LinearLayout> </LinearLayout> Landscape version of main_menu.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuLinearLayout" android:background="#3067a8" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="10dip" android:textColor="#ffffff" android:textSize="50sp" android:text="@string/main_menu_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuSubHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="15dip" android:textColor="#ffffff" android:textSize="15sp" android:text="@string/main_menu_sub_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionList" android:layout_width="fill_parent" android:layout_height="128dip" android:paddingLeft="0dip" android:paddingTop="5dip" android:spacing="10dip" /> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionListDetailLinearLayout" android:gravity="center_vertical|center_horizontal" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuOptionListLabelTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="25sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuOptionListDescriptionTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="15sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> </LinearLayout> </LinearLayout> Thank you for your time!

    Read the article

  • Whats wrong with this simple Layout?

    - by Sebi
    Im trying to define a LinearLayout which contains another LinearLayout which should always be desplayed in the horizontal and vertical center. An ImageView should be placed always vertically centered on the right side of the parent Layout: A B I defined it the following: <LinearLayout android:id="@+id/footer" android:orientation="horizontal" android:layout_height="50px" android:paddingTop="5px" android:layout_width="wrap_content" android:background="@drawable/footer_border" android:paddingRight="5px" android:paddingLeft="5px" android:layout_gravity="center_horizontal" <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:id="@+id/loading"> </ImageView> </LinearLayout> But unfornatuley its not working... The LinearLayout (A) and the ImageView (B) is on the left side.... But i set gravity to center and right?? Why?

    Read the article

  • UIAlertView with subview animating to new view crashes app

    - by William
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congratulations" message:message delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"View", nil]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(110, 100, 80, 80)]; NSString *imagePath = [NSString stringWithFormat:@"%@", [Array objectAtIndex:x]]; UIImage *bkgImg = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:imagePath ofType:@"png"]]; imageView.image = bkgImg; [bkgImg release]; [alert addSubview:imageView]; [imageView release]; [alert show]; [alert release]; That is the code that I am using to create the alert view. Currently, I have it set up so if the user presses one of the buttons, it will load up a new viewcontroller. It worked fine until I added a subview to the UIAlertView. Now, whenever it animates to the new screen, it just crashes the program. I am fairly new to iPhone development and any help would be appreciated.

    Read the article

  • Can`t draw in CAlayer.

    - by Ann
    HI All. I have subclass of UIScrollView. IN this class I have added some imageView.layer to self.layer. And when I call [imageView.layer setNeedsDisplay] my implemented delegate never called. -(void)drawLayer:(CALayer*)layer :(CGContextRef)context I`ve also set imageView.layer.delegate = self Could anyone tell me where I must set delegate function to make this to work. Thank you for advance.

    Read the article

  • Set start opacity then animate

    - by Joelbitar
    I have two ImageView's in a FrameLayout of which one (the one on top) is to be animated. I want it to fade in and continuously rotate, the animation works fine and looks like this: http://code.google.com/p/switchctrl/source/browse/trunk/android/res/anim/device_loading_fadein.xml ImageView loading = (ImageView) v.findViewById(R.id.loading_anim); Animation loading_animation = AnimationUtils.loadAnimation(getContext(), loading_animation_id); loading.startAnimation(loading_animation); I can not setAlpha on the loading image, if I do the animation does not quite work.

    Read the article

  • Android: chronometer widget and layout() method could not work well at the same time

    - by Lennard
    I write a test android app, in which there are only two views, a chronometer and a imageview. Using the layout() method of the imageview to dynamically change the position of it, I wish to implement drag-and-drop effect. It does work. However, each time the chronometer ticks, the imageview is always reverted to its original position, which seems that the whole screen is reloaded from the layout xml. So, does anybody know how to prevent the imageview from reverting to the original place, and let chronometer and drag-and-drop effect coexist? Thx

    Read the article

  • UIView animation problem

    - by FoJjen
    I try to make a UIImageView open like a hatch, and under the "hatchView" its anoter imageView but when I start the animation its like the view under gets over and cover the animation, When the animation gets over the imageView the its getting visibel. its works fine if a remove the imageView thats under. Here is the code for animation view. - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *) event { if (!isHatchOpen) { if (hatchView.layer.anchorPoint.x != 0.0f) { hatchView.layer.anchorPoint = CGPointMake(0.0f, 0.5f); hatchView.center = CGPointMake(hatchView.center.x - hatchView.bounds.size.width/2.0f, hatchView.center.y); } UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInView:hatchView]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationBeginsFromCurrentState:YES]; float pct = location.x / 320.0f; float rad = acosf(pct); CATransform3D transform = CATransform3DMakeRotation(-rad+5, 0.0f, -1.0f, 0.0f); transform.m14 = (1.0 / -2000) * acosf(pct); hatchView.layer.transform = transform; [UIView commitAnimations]; isHatchOpen = YES; } else { if (hatchView.layer.anchorPoint.x != 0.0f) { hatchView.layer.anchorPoint = CGPointMake(0.0f, 0.5f); hatchView.center = CGPointMake(hatchView.center.x - hatchView.bounds.size.width/2.0f, hatchView.center.y); } [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationBeginsFromCurrentState:YES]; CATransform3D transform = CATransform3DMakeRotation(0, 0.0f, -1.0f, 0.0f); transform.m14 = 0; hatchView.layer.transform = transform; // Commit the changes [UIView commitAnimations]; isHatchOpen = NO; } } And here a add the Views hatchView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 1, frame.size.width-1, frame.size.height-2)]; [self addSubview:hatchView]; imageView = [[UIImageView alloc] initWithFrame:CGRectMake(1, 1, frame.size.width-2, frame.size.height-2)]; imageView.contentMode = UIViewContentModeScaleAspectFit; [self insertSubview:imageView belowSubview:hatchView];

    Read the article

  • iPhone - NSURLConnection does not receive data

    - by Jukurrpa
    Hi, I have a pretty weird problem with NSURLRequest. I'm using them to make an asynchronous image loading in an UITableView. The first time the tableView displays, all connections from NSURLRequests open correctly but receive absolutely no data, regardless of how long I wait. But as soon as I scroll down in the tableView, the newly created requests for the new cells work perfectly! The only way for the images on top of the tableView to load is to make them disappear by scrolling down and then up again, in order to create new requests. Here is what I do in "cellForRowAtIndexPath": UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; if (cell == nil) { cell = [[UITableViewCell alloc] initWIthFrame:CGRectMake(0, 0, 300, 60)]; AsyncUIImageView imageView = [[AsynUIImageView alloc] initWithFrame:CGRectMake(0, 0, 60, 60)]; imageView.tag = IMG_VIEW // an enum for tags [cell addSubView:imageView]; [imageView release]; } AsyncUIImageView imageView = (AsyncUIImageView*)[cell viewWithTag:IMG_VIEW]; // I do a few cache checks here, but if the image aint cached I do this: [imageView loadImageFromURL:@"http://someurl.com/somepix.jpg"]; // all urls are different, just an example The AsyncUIImageView inherits from UIImageView and contains an NSURLConnection which opens upon calling the loadImageFromURL method: (void) loadImageFromURL:(NSString*)filename { if (self.connection != nil) [self.connection release]; if (self.data != nil) [self.data release]; NSURLRequest* request = [NSURLRequest requestWithURL:[[NSURL alloc] initWithString:fileName] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; self.connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if (self.connection == nil) return; self.data = [[NSMutableData data] retain]; } I've created the delegate methods "connection: didReceiveData", which appends received data to self.data and "connectionDidFinishLoading" which sets the image and closes the connection once the transfer is complete. These work, but are never called for the first requests I create. I suspect this bug to come from the main thread not giving the first requests the control so they can execute themselves, as the same behavior happens if I keep my finger on the screen after a scroll: connections open themselves, but no data is received until I stop touching the screen. What am I doing wrong?

    Read the article

  • How can we make the video play in a small view and also filling that whole view?

    - by wolverine
    I have added an imageView of size 300*300 into the interface in my ipad project. I can play the video fullscreen using MPMOviePlayerController. And I am trying to make it play in the imageView by using the following code. [imageView1 addSubview:moviePlayer.view]; [self.moviePlayer play]; Its playing but not as fullscreen and also not filling the whole imageview. Its kind of playing on the top quarter of the view and that too not the whole movie view - about lower right 60% only. How can I fix this? How can I make the movie play on the whole imageview like it plays on the full screen?

    Read the article

  • IOS center bottom position view

    - by Ben_hawk
    I do the following to a loading animation, to place it at the bottom center of the screen. CGPoint bottomCenter = CGPointMake((self.imageView.bounds.size.width / 2), (self.imageView.bounds.size.height * 0.8)); self.activityView.center = bottomCenter; (imageView is the full screen splash image) If the orientation is portrait, it is positioned perfectly, however turning on its side, in landscape or upside down portrait and the animation ends up miles away :S Does anyone know the correct way to position this loading animation, its for the splash screen.

    Read the article

  • UIImage for UIImageView is nil

    - by yeesterbunny
    I'm having problem displaying UIImage in UIImageView. I looked all over stackoverflow for similar questions, but none of the fixes helped me. The image is indeed in my bundle File Inspector - Target Membership is checked for the image IBOutlet is connected (I have tried both using IBOutlet and doing it programmatically) Both png nor jpg works Here's the code for using Interface Builder - //@property and @synthesize set for IBOutlet UIImageView *imageView - (void)viewDidLoad { [super viewDidLoad]; NSAssert(self.imageView, @"self.imageView is nil. Check your IBOutlet connection"); UIImage *image = [UIImage imageNamed:@"banner.jpg"]; NSAssert(image, @"image is nil"); self.imageView.image = image; } This code will terminate with NSAssert, printing in the console that 'image is nil'. I also tried selecting the Image directly from the attributes inspector: However it still doesn't show the image (still terminates with NSAssert - 'image is nil'). Any help or suggestions will be greatly appreciated. Thanks

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >