logo
down
shadow

Trouble setting UIImageView image from another view controller


Trouble setting UIImageView image from another view controller

By : Lewa Wang
Date : November 18 2020, 03:49 PM
hop of those help? The issue seems like your imgView is nil. So make sure that your method should not get called, before your view has been loaded.
code :


Share : facebook icon twitter icon
IBAction to set UIImageview image in second View Controller?

IBAction to set UIImageview image in second View Controller?


By : user3869529
Date : March 29 2020, 07:55 AM
This might help you When the button is pressed in viewController1, do something like this:
code :
-(IBAction)buttonpressed:(id)sender {
    if (button.tag == 1) {
        [[NSUserDefaults standardUserDefaults] setObject:@"image1.png" 
            forKey:@"viewController2SelectedImageKey"];
    } else if (button.tag == 2) {
        [[NSUserDefaults standardUserDefaults] setObject:@"image2.png" 
            forKey:@"viewController2SelectedImageKey"];
    } else {
        //set some default string for the image
        [[NSUserDefaults standardUserDefaults] setObject:@"yourDefaultImage.png" 
            forKey:@"viewController2SelectedImageKey"];
    }
}
- (void)viewDidLoad {
    ViewController2ImageView.image = [UIImage imageNamed:[[NSUserDefaults 
        standardUserDefaults] objectForKey:@"viewController2SelectedImageKey"]];
    //other setup
}
Send image to another view controller UIImageView IOS 5.1

Send image to another view controller UIImageView IOS 5.1


By : D4vid99
Date : March 29 2020, 07:55 AM
Hope this helps I have a list of names from Facebook in my uitableview , when user select a row user detail should be shown in another view. , This line is the problem:
code :
profileDetailPicture.profileImage.image= transferImage.image
Trouble updating/setting the image in a UIImageView

Trouble updating/setting the image in a UIImageView


By : Mauricio Eduardo
Date : March 29 2020, 07:55 AM
wish of those help myImage is null, so any call on it has no effect, something should be assigned to it beforehand (myImage = ... or self.myImage = ...)
How to change UIImageView's image in another view controller?

How to change UIImageView's image in another view controller?


By : Leonick
Date : March 29 2020, 07:55 AM
like below fixes the issue According to this line if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"server"] isEqualToString:@"imap.mail.me.com"]) will get true means, your demoController.imageBG.image always have junk.png.
I think you missing {} between if body.
code :
if (indexPath.row == 0)
{
    theAppDelegate.folder = @"INBOX";
    UIImage *image = [UIImage imageNamed:@"inbox.png"];
    demoController.imageBG.image = image;    
}
 if (indexPath.row == 1)
     .........
uiimageview not showing image in view controller

uiimageview not showing image in view controller


By : user2223000
Date : March 29 2020, 07:55 AM
wish helps you I am trying to display a chart image in my view controller. I have an image called 'powerchart' in my assets, but I cannot get it to display in the view controller. I am trying to build the app programatically, therefore not using storyboard. code below. I've tried using several combinations of UIImage. functions, but cannot get the image to load. Any help would be appreciated , Declare This Way. Below code works fine for me.
code :
import UIKit

class ViewController: UIViewController {
    /*
    let marketChart: UIImageView = {
        let chart = UIImageView()
        chart.image = UIImage.init(imageLiteralResourceName: "backimg3.jpeg")
        return chart
    }() */
    let marketChart:UIImageView = UIImageView.init(image: UIImage (named: "backimg3.jpeg"))

    override func viewDidLoad() {
        super.viewDidLoad()
           self.view.addSubview(marketChart)
    }


}
Related Posts Related Posts :
  • Axis change of stackView giving layout error
  • How to use AVAssetResourceLoader?
  • How to write block definition using properties?
  • iOS connect/reconnect to Bluetooth device when using external-accessory and MFi
  • Saving XMPP Multi User chat messages through XMPP MessageArchiving in iOS
  • Deciding iOS version: pros and cons
  • iOS: Resigned app cannot access keychain through security API
  • How can I set To and Subject fields in an E-Mail being sent by UIDocumentInteractionController?
  • Updating uilabel in view controller underneath another
  • Maximum time Intervel for NSTimer
  • Delete Core Data Entry from Table View Controller
  • How to unload UIViewcontroller from memory?
  • Compressing UIImage as Far as Possible?
  • Optimizing workflow to update internally owned cocoapods dependencies?
  • Formatting an NSDate with Abbreviated Month/Day Names
  • I'm creating a quiz game with 4 answers and I want to add score
  • Tap Gesture to Hide Navigation Bar, Tab Bar, and Status Bar
  • FBSessionStateClosedLoginFailed when I am logged in through Settings
  • CGRect positioning according to center point
  • iOS: Update table view datasource with animations without core data
  • iOS : Where to start for AliPay integration?
  • Routing App Coverage File missing but not needed?
  • Drawing on a zoomable view
  • Append NSStrings and NSNumber to NSMutableArrays and make NSMutable dictionary
  • Terminating app due to uncaught exception 'NSRangeException' when calling dequeueReusableCellWithReuseIdentifier:forInde
  • Collision without physics (Cocos2D + Box2D iOS)
  • Creating a percentage based iOS layout
  • Update tableView row from AppDelegate Swift 4
  • Assigning return value of a class method to a variable error
  • how to display circular progress in delphi ios apps?
  • I can't figure how to fix this Expected identifier or '('
  • How to Test APIs in Swift 4?
  • Link error /Build/Products/Debug-iphonesimulator file not found
  • working with a very large JSON object in iOS
  • Turn off part of the iPhone Screen
  • Phonegap 3.0 app with facebook login using xCode
  • How to add interstitial admob ads to my ios project
  • adding tapku calendar to ios app
  • Add an alertcontroller in a global swift file?
  • Take square image with Cordova (Phonegap) Camera API?
  • Amazon S3 policy allowing only upload not overwrite
  • How to change the UILabel content by tapping?
  • Adding checkmark to selected table cell also checks another table cell
  • UICollectionView cellForItemAtIndexPath indexPath row is nil
  • Resize and set quality on JPEG image while retaining EXIF in iOS
  • How to push rootviewcontroller in Ios
  • How to add UIBarbuttonItem at centre on UInavigationbar in iOS
  • Would this IOS device test crash be expected
  • PickerView not showing any values
  • How to set root view controller in storyboard animated with navigation controller programmatically
  • Can anyone suggest me the effective way to deal with s3 upload fail because of timezone difference issue?
  • Getting list of files in documents folder
  • Error while using Realm Object as a singleton. Is it a good idea?
  • inserting into SQLite database
  • More nodes than I should
  • Facebook IOS SDK navigate to another controller after login not working
  • Swift Array - use "Contains" of type AnyObject
  • Sidebar menu with indicate navigationbar on iOS
  • Programmatically set size of UIView from Storyboard
  • Navigation bar blink
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org